@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.
- package/.editorconfig +13 -0
- package/.eslintrc.json +51 -0
- package/.travis.yml +38 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +22 -0
- package/README.md +296 -0
- package/angular.json +108 -0
- package/package.json +71 -0
- package/projects/gallery/.eslintrc.json +55 -0
- package/projects/gallery/README.md +24 -0
- package/projects/gallery/karma.conf.js +52 -0
- package/projects/gallery/ng-package.json +7 -0
- package/projects/gallery/package.json +32 -0
- package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.html +4 -0
- package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.scss +21 -0
- package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.spec.ts +25 -0
- package/projects/gallery/src/lib/ngx-gallery-action/ngx-gallery-action.component.ts +28 -0
- package/projects/gallery/src/lib/ngx-gallery-action.ts +23 -0
- package/projects/gallery/src/lib/ngx-gallery-animation.ts +6 -0
- package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.html +12 -0
- package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.scss +45 -0
- package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.spec.ts +25 -0
- package/projects/gallery/src/lib/ngx-gallery-arrows/ngx-gallery-arrows.component.ts +28 -0
- package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.html +4 -0
- package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.scss +26 -0
- package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.spec.ts +25 -0
- package/projects/gallery/src/lib/ngx-gallery-bullets/ngx-gallery-bullets.component.ts +25 -0
- package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.html +49 -0
- package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.scss +106 -0
- package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.spec.ts +35 -0
- package/projects/gallery/src/lib/ngx-gallery-image/ngx-gallery-image.component.ts +395 -0
- package/projects/gallery/src/lib/ngx-gallery-image-size.ts +4 -0
- package/projects/gallery/src/lib/ngx-gallery-image.ts +31 -0
- package/projects/gallery/src/lib/ngx-gallery-layout.ts +4 -0
- package/projects/gallery/src/lib/ngx-gallery-options.ts +255 -0
- package/projects/gallery/src/lib/ngx-gallery-order.ts +5 -0
- package/projects/gallery/src/lib/ngx-gallery-ordered-image.ts +19 -0
- package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.html +66 -0
- package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.scss +121 -0
- package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.spec.ts +34 -0
- package/projects/gallery/src/lib/ngx-gallery-preview/ngx-gallery-preview.component.ts +486 -0
- package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.html +44 -0
- package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.scss +87 -0
- package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.spec.ts +31 -0
- package/projects/gallery/src/lib/ngx-gallery-thumbnails/ngx-gallery-thumbnails.component.ts +297 -0
- package/projects/gallery/src/lib/ngx-gallery.component.html +53 -0
- package/projects/gallery/src/lib/ngx-gallery.component.scss +78 -0
- package/projects/gallery/src/lib/ngx-gallery.component.spec.ts +37 -0
- package/projects/gallery/src/lib/ngx-gallery.component.ts +337 -0
- package/projects/gallery/src/lib/ngx-gallery.module.ts +29 -0
- package/projects/gallery/src/lib/ngx-gallery.service.spec.ts +18 -0
- package/projects/gallery/src/lib/ngx-gallery.service.ts +71 -0
- package/projects/gallery/src/public-api.ts +20 -0
- package/projects/gallery/src/test.ts +17 -0
- package/projects/gallery/tsconfig.lib.json +14 -0
- package/projects/gallery/tsconfig.lib.prod.json +9 -0
- package/projects/gallery/tsconfig.spec.json +16 -0
- package/projects/gallery-app/.browserslistrc +12 -0
- package/projects/gallery-app/.eslintrc.json +40 -0
- package/projects/gallery-app/e2e/protractor.conf.js +32 -0
- package/projects/gallery-app/e2e/src/app.e2e-spec.ts +23 -0
- package/projects/gallery-app/e2e/src/app.po.ts +11 -0
- package/projects/gallery-app/e2e/tsconfig.json +13 -0
- package/projects/gallery-app/karma.conf.js +32 -0
- package/projects/gallery-app/src/app/app-routing.module.ts +11 -0
- package/projects/gallery-app/src/app/app.component.html +4 -0
- package/projects/gallery-app/src/app/app.component.scss +9 -0
- package/projects/gallery-app/src/app/app.component.spec.ts +35 -0
- package/projects/gallery-app/src/app/app.component.ts +76 -0
- package/projects/gallery-app/src/app/app.module.ts +21 -0
- package/projects/gallery-app/src/assets/.gitkeep +0 -0
- package/projects/gallery-app/src/assets/img/gallery/1-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/1-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/1-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/2-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/2-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/2-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/3-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/3-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/3-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/4-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/4-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/4-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/5-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/5-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/5-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/6-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/6-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/6-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/7-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/7-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/7-small.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/8-big.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/8-medium.jpeg +0 -0
- package/projects/gallery-app/src/assets/img/gallery/8-small.jpeg +0 -0
- package/projects/gallery-app/src/environments/environment.prod.ts +3 -0
- package/projects/gallery-app/src/environments/environment.ts +16 -0
- package/projects/gallery-app/src/favicon.ico +0 -0
- package/projects/gallery-app/src/index.html +13 -0
- package/projects/gallery-app/src/main.ts +12 -0
- package/projects/gallery-app/src/polyfills.ts +53 -0
- package/projects/gallery-app/src/styles.scss +1 -0
- package/projects/gallery-app/src/test.ts +16 -0
- package/projects/gallery-app/tsconfig.app.json +17 -0
- package/projects/gallery-app/tsconfig.spec.json +18 -0
- package/tsconfig.json +43 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
ElementRef,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
HostListener,
|
|
7
|
+
Input,
|
|
8
|
+
OnChanges,
|
|
9
|
+
OnInit,
|
|
10
|
+
Output,
|
|
11
|
+
SimpleChanges
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import {DomSanitizer, SafeResourceUrl, SafeStyle} from '@angular/platform-browser';
|
|
14
|
+
import {NgxGalleryService} from '../ngx-gallery.service';
|
|
15
|
+
import {NgxGalleryAction} from '../ngx-gallery-action';
|
|
16
|
+
import {NgxGalleryOrder} from '../ngx-gallery-order';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
selector: 'ngx-gallery-thumbnails',
|
|
20
|
+
templateUrl: './ngx-gallery-thumbnails.component.html',
|
|
21
|
+
styleUrls: ['./ngx-gallery-thumbnails.component.scss'],
|
|
22
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
|
+
standalone: false
|
|
24
|
+
})
|
|
25
|
+
export class NgxGalleryThumbnailsComponent implements OnChanges {
|
|
26
|
+
thumbnailsLeft: string;
|
|
27
|
+
thumbnailsMarginLeft: string;
|
|
28
|
+
mouseenter: boolean;
|
|
29
|
+
remainingCountValue: number;
|
|
30
|
+
|
|
31
|
+
minStopIndex = 0;
|
|
32
|
+
|
|
33
|
+
@Input() images: string[] | SafeResourceUrl[];
|
|
34
|
+
@Input() isAnimating: boolean;
|
|
35
|
+
@Input() links: string[];
|
|
36
|
+
@Input() labels: string[];
|
|
37
|
+
@Input() linkTarget: string;
|
|
38
|
+
@Input() columns: number;
|
|
39
|
+
@Input() rows: number;
|
|
40
|
+
@Input() arrows: boolean;
|
|
41
|
+
@Input() arrowsAutoHide: boolean;
|
|
42
|
+
@Input() margin: number;
|
|
43
|
+
@Input() selectedIndex: number;
|
|
44
|
+
@Input() clickable: boolean;
|
|
45
|
+
@Input() swipe: boolean;
|
|
46
|
+
@Input() size: string;
|
|
47
|
+
@Input() arrowPrevIcon: string;
|
|
48
|
+
@Input() arrowNextIcon: string;
|
|
49
|
+
@Input() moveSize: number;
|
|
50
|
+
@Input() order: number;
|
|
51
|
+
@Input() remainingCount: boolean;
|
|
52
|
+
@Input() lazyLoading: boolean;
|
|
53
|
+
@Input() actions: NgxGalleryAction[];
|
|
54
|
+
|
|
55
|
+
@Output() activeChange = new EventEmitter();
|
|
56
|
+
|
|
57
|
+
private index = 0;
|
|
58
|
+
|
|
59
|
+
constructor(private sanitization: DomSanitizer, private elementRef: ElementRef,
|
|
60
|
+
private helperService: NgxGalleryService) {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
64
|
+
if (changes['selectedIndex']) {
|
|
65
|
+
this.validateIndex();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (changes['swipe']) {
|
|
69
|
+
this.helperService.manageSwipe(this.swipe, this.elementRef,
|
|
70
|
+
'thumbnails', () => this.moveRight(), () => this.moveLeft());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (this.images) {
|
|
74
|
+
this.remainingCountValue = this.images.length - (this.rows * this.columns);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@HostListener('mouseenter') onMouseEnter() {
|
|
79
|
+
this.mouseenter = true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@HostListener('mouseleave') onMouseLeave() {
|
|
83
|
+
this.mouseenter = false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
reset(index: number): void {
|
|
87
|
+
this.selectedIndex = index;
|
|
88
|
+
this.setDefaultPosition();
|
|
89
|
+
|
|
90
|
+
this.index = 0;
|
|
91
|
+
this.validateIndex();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getImages(): string[] | SafeResourceUrl[] {
|
|
95
|
+
if (!this.images) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (this.remainingCount) {
|
|
100
|
+
return this.images.slice(0, this.rows * this.columns);
|
|
101
|
+
} else if (this.lazyLoading && this.order !== NgxGalleryOrder.Row) {
|
|
102
|
+
let stopIndex = 0;
|
|
103
|
+
|
|
104
|
+
if (this.order === NgxGalleryOrder.Column) {
|
|
105
|
+
stopIndex = (this.index + this.columns + this.moveSize) * this.rows;
|
|
106
|
+
} else if (this.order === NgxGalleryOrder.Page) {
|
|
107
|
+
stopIndex = this.index + ((this.columns * this.rows) * 2);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (stopIndex <= this.minStopIndex) {
|
|
111
|
+
stopIndex = this.minStopIndex;
|
|
112
|
+
} else {
|
|
113
|
+
this.minStopIndex = stopIndex;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return this.images.slice(0, stopIndex);
|
|
117
|
+
} else {
|
|
118
|
+
return this.images;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
handleClick(event: Event, index: number): void {
|
|
123
|
+
if (!this.hasLink(index) && !this.isAnimating) {
|
|
124
|
+
this.selectedIndex = index;
|
|
125
|
+
this.activeChange.emit(index);
|
|
126
|
+
}
|
|
127
|
+
event.stopPropagation();
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
hasLink(index: number): boolean {
|
|
132
|
+
return !!(this.links && this.links.length && this.links[index]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
moveRight(): void {
|
|
136
|
+
if (this.canMoveRight()) {
|
|
137
|
+
this.index += this.moveSize;
|
|
138
|
+
const maxIndex = this.getMaxIndex() - this.columns;
|
|
139
|
+
|
|
140
|
+
if (this.index > maxIndex) {
|
|
141
|
+
this.index = maxIndex;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
this.setThumbnailsPosition();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
moveLeft(): void {
|
|
149
|
+
if (this.canMoveLeft()) {
|
|
150
|
+
this.index -= this.moveSize;
|
|
151
|
+
|
|
152
|
+
if (this.index < 0) {
|
|
153
|
+
this.index = 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.setThumbnailsPosition();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
canMoveRight(): boolean {
|
|
161
|
+
return this.index + this.columns < this.getMaxIndex();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
canMoveLeft(): boolean {
|
|
165
|
+
return this.index !== 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getThumbnailLeft(index: number): SafeStyle {
|
|
169
|
+
let calculatedIndex;
|
|
170
|
+
|
|
171
|
+
if (this.order === NgxGalleryOrder.Column) {
|
|
172
|
+
calculatedIndex = Math.floor(index / this.rows);
|
|
173
|
+
} else if (this.order === NgxGalleryOrder.Page) {
|
|
174
|
+
calculatedIndex = (index % this.columns) + (Math.floor(index / (this.rows * this.columns)) * this.columns);
|
|
175
|
+
} else if (this.order === NgxGalleryOrder.Row && this.remainingCount) {
|
|
176
|
+
calculatedIndex = index % this.columns;
|
|
177
|
+
} else {
|
|
178
|
+
calculatedIndex = index % Math.ceil(this.images.length / this.rows);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return this.getThumbnailPosition(calculatedIndex, this.columns);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getThumbnailTop(index: number): SafeStyle {
|
|
185
|
+
let calculatedIndex;
|
|
186
|
+
|
|
187
|
+
if (this.order === NgxGalleryOrder.Column) {
|
|
188
|
+
calculatedIndex = index % this.rows;
|
|
189
|
+
} else if (this.order === NgxGalleryOrder.Page) {
|
|
190
|
+
calculatedIndex = Math.floor(index / this.columns) - (Math.floor(index / (this.rows * this.columns)) * this.rows);
|
|
191
|
+
} else if (this.order === NgxGalleryOrder.Row && this.remainingCount) {
|
|
192
|
+
calculatedIndex = Math.floor(index / this.columns);
|
|
193
|
+
} else {
|
|
194
|
+
calculatedIndex = Math.floor(index / Math.ceil(this.images.length / this.rows));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return this.getThumbnailPosition(calculatedIndex, this.rows);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
getThumbnailWidth(): SafeStyle {
|
|
201
|
+
return this.getThumbnailDimension(this.columns);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
getThumbnailHeight(): SafeStyle {
|
|
205
|
+
return this.getThumbnailDimension(this.rows);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
setThumbnailsPosition(): void {
|
|
209
|
+
this.thumbnailsLeft = -((100 / this.columns) * this.index) + '%';
|
|
210
|
+
|
|
211
|
+
this.thumbnailsMarginLeft = -((this.margin - (((this.columns - 1)
|
|
212
|
+
* this.margin) / this.columns)) * this.index) + 'px';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
setDefaultPosition(): void {
|
|
216
|
+
this.thumbnailsLeft = '0px';
|
|
217
|
+
this.thumbnailsMarginLeft = '0px';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
canShowArrows(): boolean {
|
|
221
|
+
if (this.remainingCount) {
|
|
222
|
+
return false;
|
|
223
|
+
} else {
|
|
224
|
+
return this.arrows && this.images && this.images.length > this.getVisibleCount()
|
|
225
|
+
&& (!this.arrowsAutoHide || this.mouseenter);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
validateIndex(): void {
|
|
230
|
+
if (this.images) {
|
|
231
|
+
let newIndex;
|
|
232
|
+
|
|
233
|
+
if (this.order === NgxGalleryOrder.Column) {
|
|
234
|
+
newIndex = Math.floor(this.selectedIndex / this.rows);
|
|
235
|
+
} else {
|
|
236
|
+
newIndex = this.selectedIndex % Math.ceil(this.images.length / this.rows);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (this.remainingCount) {
|
|
240
|
+
newIndex = 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (newIndex < this.index || newIndex >= this.index + this.columns) {
|
|
244
|
+
const maxIndex = this.getMaxIndex() - this.columns;
|
|
245
|
+
this.index = newIndex > maxIndex ? maxIndex : newIndex;
|
|
246
|
+
|
|
247
|
+
this.setThumbnailsPosition();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
getSafeUrl(image: string | SafeResourceUrl): SafeStyle {
|
|
253
|
+
return this.sanitization.bypassSecurityTrustStyle(this.helperService.getBackgroundUrl(image.toString()));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
getFileType(fileSource: string | SafeResourceUrl): string {
|
|
257
|
+
return this.helperService.getFileType(fileSource.toString());
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private getThumbnailPosition(index: number, count: number): SafeStyle {
|
|
261
|
+
return this.getSafeStyle('calc(' + ((100 / count) * index) + '% + '
|
|
262
|
+
+ ((this.margin - (((count - 1) * this.margin) / count)) * index) + 'px)');
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private getThumbnailDimension(count: number): SafeStyle {
|
|
266
|
+
if (this.margin !== 0) {
|
|
267
|
+
return this.getSafeStyle('calc(' + (100 / count) + '% - '
|
|
268
|
+
+ (((count - 1) * this.margin) / count) + 'px)');
|
|
269
|
+
} else {
|
|
270
|
+
return this.getSafeStyle('calc(' + (100 / count) + '% + 1px)');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private getMaxIndex(): number {
|
|
275
|
+
if (this.order === NgxGalleryOrder.Page) {
|
|
276
|
+
let maxIndex = (Math.floor(this.images.length / this.getVisibleCount()) * this.columns);
|
|
277
|
+
|
|
278
|
+
if (this.images.length % this.getVisibleCount() > this.columns) {
|
|
279
|
+
maxIndex += this.columns;
|
|
280
|
+
} else {
|
|
281
|
+
maxIndex += this.images.length % this.getVisibleCount();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return maxIndex;
|
|
285
|
+
} else {
|
|
286
|
+
return Math.ceil(this.images.length / this.rows);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
private getVisibleCount(): number {
|
|
291
|
+
return this.columns * this.rows;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private getSafeStyle(value: string): SafeStyle {
|
|
295
|
+
return this.sanitization.bypassSecurityTrustStyle(value);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<div class="ngx-gallery-layout {{currentOptions?.layout}}">
|
|
2
|
+
@if (currentOptions?.image) {
|
|
3
|
+
<ngx-gallery-image [style.height]="getImageHeight()" [images]="mediumImages" [clickable]="currentOptions?.preview"
|
|
4
|
+
[selectedIndex]="selectedIndex" [arrows]="currentOptions?.imageArrows"
|
|
5
|
+
[arrowsAutoHide]="currentOptions?.imageArrowsAutoHide" [arrowPrevIcon]="currentOptions?.arrowPrevIcon"
|
|
6
|
+
[arrowNextIcon]="currentOptions?.arrowNextIcon" [swipe]="currentOptions?.imageSwipe"
|
|
7
|
+
[animation]="currentOptions?.imageAnimation" [size]="currentOptions?.imageSize"
|
|
8
|
+
[autoPlay]="currentOptions?.imageAutoPlay" [autoPlayInterval]="currentOptions?.imageAutoPlayInterval"
|
|
9
|
+
[autoPlayPauseOnHover]="currentOptions?.imageAutoPlayPauseOnHover"
|
|
10
|
+
[infinityMove]="currentOptions?.imageInfinityMove" [lazyLoading]="currentOptions?.lazyLoading"
|
|
11
|
+
[actions]="currentOptions?.imageActions" [descriptions]="descriptions"
|
|
12
|
+
[showDescription]="currentOptions?.imageDescription" [bullets]="currentOptions?.imageBullets"
|
|
13
|
+
(imageClick)="openPreview($event)" (activeChange)="selectFromImage($event)"
|
|
14
|
+
(animating)="setAnimating($event)"></ngx-gallery-image>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@if (currentOptions?.thumbnails) {
|
|
18
|
+
<ngx-gallery-thumbnails [style.marginTop]="getThumbnailsMarginTop()"
|
|
19
|
+
[style.marginBottom]="getThumbnailsMarginBottom()" [style.height]="getThumbnailsHeight()" [images]="smallImages"
|
|
20
|
+
[isAnimating]="isAnimating" [links]="currentOptions?.thumbnailsAsLinks ? links : []" [labels]="labels"
|
|
21
|
+
[linkTarget]="currentOptions?.linkTarget" [selectedIndex]="selectedIndex"
|
|
22
|
+
[columns]="currentOptions?.thumbnailsColumns" [rows]="currentOptions?.thumbnailsRows"
|
|
23
|
+
[margin]="currentOptions?.thumbnailMargin" [arrows]="currentOptions?.thumbnailsArrows"
|
|
24
|
+
[arrowsAutoHide]="currentOptions?.thumbnailsArrowsAutoHide" [arrowPrevIcon]="currentOptions?.arrowPrevIcon"
|
|
25
|
+
[arrowNextIcon]="currentOptions?.arrowNextIcon" [clickable]="currentOptions?.image || currentOptions?.preview"
|
|
26
|
+
[swipe]="currentOptions?.thumbnailsSwipe" [size]="currentOptions?.thumbnailSize"
|
|
27
|
+
[moveSize]="currentOptions?.thumbnailsMoveSize" [order]="currentOptions?.thumbnailsOrder"
|
|
28
|
+
[remainingCount]="currentOptions?.thumbnailsRemainingCount" [lazyLoading]="currentOptions?.lazyLoading"
|
|
29
|
+
[actions]="currentOptions?.thumbnailActions" (activeChange)="selectFromThumbnails($event)"
|
|
30
|
+
[ngClass]="currentOptions?.thumbnailClasses"></ngx-gallery-thumbnails>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
<ngx-gallery-preview [images]="bigImages" [descriptions]="descriptions"
|
|
34
|
+
[showDescription]="currentOptions?.previewDescription" [arrowPrevIcon]="currentOptions?.arrowPrevIcon"
|
|
35
|
+
[arrowNextIcon]="currentOptions?.arrowNextIcon" [closeIcon]="currentOptions?.closeIcon"
|
|
36
|
+
[fullscreenIcon]="currentOptions?.fullscreenIcon" [spinnerIcon]="currentOptions?.spinnerIcon"
|
|
37
|
+
[arrows]="currentOptions?.previewArrows" [arrowsAutoHide]="currentOptions?.previewArrowsAutoHide"
|
|
38
|
+
[swipe]="currentOptions?.previewSwipe" [fullscreen]="currentOptions?.previewFullscreen"
|
|
39
|
+
[forceFullscreen]="currentOptions?.previewForceFullscreen" [closeOnClick]="currentOptions?.previewCloseOnClick"
|
|
40
|
+
[closeOnEsc]="currentOptions?.previewCloseOnEsc" [keyboardNavigation]="currentOptions?.previewKeyboardNavigation"
|
|
41
|
+
[animation]="currentOptions?.previewAnimation" [autoPlay]="currentOptions?.previewAutoPlay"
|
|
42
|
+
[autoPlayInterval]="currentOptions?.previewAutoPlayInterval"
|
|
43
|
+
[autoPlayPauseOnHover]="currentOptions?.previewAutoPlayPauseOnHover"
|
|
44
|
+
[infinityMove]="currentOptions?.previewInfinityMove" [zoom]="currentOptions?.previewZoom"
|
|
45
|
+
[zoomStep]="currentOptions?.previewZoomStep" [zoomMax]="currentOptions?.previewZoomMax"
|
|
46
|
+
[zoomMin]="currentOptions?.previewZoomMin" [zoomInIcon]="currentOptions?.zoomInIcon"
|
|
47
|
+
[zoomOutIcon]="currentOptions?.zoomOutIcon" [actions]="currentOptions?.actions"
|
|
48
|
+
[rotate]="currentOptions?.previewRotate" [rotateLeftIcon]="currentOptions?.rotateLeftIcon"
|
|
49
|
+
[rotateRightIcon]="currentOptions?.rotateRightIcon" [download]="currentOptions?.previewDownload"
|
|
50
|
+
[downloadIcon]="currentOptions?.downloadIcon" [bullets]="currentOptions?.previewBullets"
|
|
51
|
+
(previewClose)="onPreviewClose()" (previewOpen)="onPreviewOpen()" (activeChange)="previewSelect($event)"
|
|
52
|
+
[class.ngx-gallery-active]="previewEnabled"></ngx-gallery-preview>
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
|
|
4
|
+
&>* {
|
|
5
|
+
float: left;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ngx-gallery-layout {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ngx-gallery-layout.thumbnails-top {
|
|
17
|
+
ngx-gallery-image {
|
|
18
|
+
order: 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ngx-gallery-thumbnails {
|
|
22
|
+
order: 1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ngx-gallery-layout.thumbnails-bottom {
|
|
27
|
+
ngx-gallery-image {
|
|
28
|
+
order: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ngx-gallery-thumbnails {
|
|
32
|
+
order: 2;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
* {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ngx-gallery-icon {
|
|
41
|
+
color: white;
|
|
42
|
+
position: absolute;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
|
|
45
|
+
.ngx-gallery-icon-content {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ngx-gallery-preview {
|
|
51
|
+
touch-action: pan-y;
|
|
52
|
+
user-select: none;
|
|
53
|
+
display: block;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
|
|
57
|
+
font-size: 25px;
|
|
58
|
+
|
|
59
|
+
.ngx-gallery-icon {
|
|
60
|
+
z-index: 2000;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ngx-gallery-clickable {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ngx-gallery-icons-wrapper .ngx-gallery-icon {
|
|
69
|
+
position: relative;
|
|
70
|
+
margin-right: 5px;
|
|
71
|
+
margin-top: 5px;
|
|
72
|
+
font-size: 20px;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ngx-gallery-icons-wrapper {
|
|
77
|
+
float: right;
|
|
78
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import {NgxGalleryComponent} from './ngx-gallery.component';
|
|
4
|
+
import {NgxGalleryImageComponent} from './ngx-gallery-image/ngx-gallery-image.component';
|
|
5
|
+
import {NgxGalleryThumbnailsComponent} from './ngx-gallery-thumbnails/ngx-gallery-thumbnails.component';
|
|
6
|
+
import {NgxGalleryPreviewComponent} from './ngx-gallery-preview/ngx-gallery-preview.component';
|
|
7
|
+
import {NgxGalleryActionComponent} from './ngx-gallery-action/ngx-gallery-action.component';
|
|
8
|
+
import {NgxGalleryBulletsComponent} from './ngx-gallery-bullets/ngx-gallery-bullets.component';
|
|
9
|
+
import {NgxGalleryArrowsComponent} from './ngx-gallery-arrows/ngx-gallery-arrows.component';
|
|
10
|
+
|
|
11
|
+
describe('NgxGalleryComponent', () => {
|
|
12
|
+
let component: NgxGalleryComponent;
|
|
13
|
+
let fixture: ComponentFixture<NgxGalleryComponent>;
|
|
14
|
+
|
|
15
|
+
beforeEach(async(() => {
|
|
16
|
+
TestBed.configureTestingModule({
|
|
17
|
+
declarations: [NgxGalleryComponent,
|
|
18
|
+
NgxGalleryImageComponent,
|
|
19
|
+
NgxGalleryThumbnailsComponent,
|
|
20
|
+
NgxGalleryPreviewComponent,
|
|
21
|
+
NgxGalleryActionComponent,
|
|
22
|
+
NgxGalleryBulletsComponent,
|
|
23
|
+
NgxGalleryArrowsComponent]
|
|
24
|
+
})
|
|
25
|
+
.compileComponents();
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
fixture = TestBed.createComponent(NgxGalleryComponent);
|
|
30
|
+
component = fixture.componentInstance;
|
|
31
|
+
fixture.detectChanges();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should create', () => {
|
|
35
|
+
expect(component).toBeTruthy();
|
|
36
|
+
});
|
|
37
|
+
});
|