@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,24 @@
|
|
|
1
|
+
# Gallery
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.0-rc.3.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project gallery` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project gallery`.
|
|
8
|
+
> Note: Don't forget to add `--project gallery` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build gallery` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build gallery`, go to the dist folder `cd dist/gallery` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test gallery` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular', 'viewport'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-coverage'),
|
|
10
|
+
require('karma-jasmine'),
|
|
11
|
+
require('karma-chrome-launcher'),
|
|
12
|
+
require('karma-jasmine-html-reporter'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma'),
|
|
14
|
+
require('karma-viewport'),
|
|
15
|
+
],
|
|
16
|
+
client: {
|
|
17
|
+
jasmine: {
|
|
18
|
+
// you can add configuration options for Jasmine here
|
|
19
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
20
|
+
// for example, you can disable the random execution with `random: false`
|
|
21
|
+
// or set a specific seed with `seed: 4321`
|
|
22
|
+
},
|
|
23
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
24
|
+
},
|
|
25
|
+
jasmineHtmlReporter: {
|
|
26
|
+
suppressAll: true // removes the duplicated traces
|
|
27
|
+
},
|
|
28
|
+
coverageReporter: {
|
|
29
|
+
dir: require('path').join(__dirname, '../../coverage/gallery'),
|
|
30
|
+
subdir: '.',
|
|
31
|
+
reporters: [
|
|
32
|
+
{ type: 'html' },
|
|
33
|
+
{ type: 'text-summary' },
|
|
34
|
+
{ type: 'lcovonly' },
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
reporters: ['progress', 'kjhtml'],
|
|
38
|
+
port: 9876,
|
|
39
|
+
colors: true,
|
|
40
|
+
logLevel: config.LOG_INFO,
|
|
41
|
+
autoWatch: true,
|
|
42
|
+
browsers: ['Chrome'],
|
|
43
|
+
customLaunchers: {
|
|
44
|
+
ChromeHeadlessNoSandbox: {
|
|
45
|
+
base: 'ChromeHeadless',
|
|
46
|
+
flags: ['--no-sandbox']
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
singleRun: false,
|
|
50
|
+
restartOnFileChange: true
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autotaxatiepartners/ngx-gallery",
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "A simple responsive native gallery component for Angular 13 through 20.",
|
|
5
|
+
"author": "Wouter Doornbos <your@email.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://gitlab.com/autotaxatiepartners/ngx-gallery.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"private": false,
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://gitlab.com/autotaxatiepartners/ngx-gallery/-/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://gitlab.com/autotaxatiepartners/ngx-gallery#readme",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@angular/common": ">=13.0.0 <21",
|
|
18
|
+
"@angular/core": ">=13.0.0 <21",
|
|
19
|
+
"@angular/animations": ">=13.0.0 <21"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"tslib": "^2.3.0"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"angular",
|
|
26
|
+
"gallery",
|
|
27
|
+
"component",
|
|
28
|
+
"ngx-gallery",
|
|
29
|
+
"responsive",
|
|
30
|
+
"autotaxatiepartners"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.ngx-gallery-icon {
|
|
2
|
+
color: white;
|
|
3
|
+
font-size: 25px;
|
|
4
|
+
position: absolute;
|
|
5
|
+
z-index: 2000;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
}
|
|
8
|
+
//.ngx-gallery-preview-icons {
|
|
9
|
+
.ngx-gallery-icon {
|
|
10
|
+
position: relative;
|
|
11
|
+
margin-right: 10px;
|
|
12
|
+
margin-top: 10px;
|
|
13
|
+
font-size: 25px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
}
|
|
17
|
+
//}
|
|
18
|
+
|
|
19
|
+
.ngx-gallery-icon .ngx-gallery-icon-content {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NgxGalleryActionComponent } from './ngx-gallery-action.component';
|
|
4
|
+
|
|
5
|
+
describe('NgxGalleryActionComponent', () => {
|
|
6
|
+
let component: NgxGalleryActionComponent;
|
|
7
|
+
let fixture: ComponentFixture<NgxGalleryActionComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ NgxGalleryActionComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(NgxGalleryActionComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'ngx-gallery-action',
|
|
5
|
+
templateUrl: './ngx-gallery-action.component.html',
|
|
6
|
+
styleUrls: ['./ngx-gallery-action.component.scss'],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
standalone: false
|
|
9
|
+
})
|
|
10
|
+
export class NgxGalleryActionComponent {
|
|
11
|
+
@Input() icon: string;
|
|
12
|
+
@Input() disabled = false;
|
|
13
|
+
@Input() titleText = '';
|
|
14
|
+
|
|
15
|
+
@Output() closeClick: EventEmitter<Event> = new EventEmitter();
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
handleClick(event: Event) {
|
|
21
|
+
if (!this.disabled) {
|
|
22
|
+
this.closeClick.emit(event);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface INgxGalleryAction {
|
|
2
|
+
icon: string;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
titleText?: string;
|
|
5
|
+
|
|
6
|
+
onClick: (event: Event, index: number) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class NgxGalleryAction implements INgxGalleryAction {
|
|
10
|
+
icon: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
titleText?: string;
|
|
13
|
+
|
|
14
|
+
onClick: (event: Event, index: number) => void;
|
|
15
|
+
|
|
16
|
+
constructor(action: INgxGalleryAction) {
|
|
17
|
+
this.icon = action.icon;
|
|
18
|
+
this.disabled = action.disabled ? action.disabled : false;
|
|
19
|
+
this.titleText = action.titleText ? action.titleText : '';
|
|
20
|
+
|
|
21
|
+
this.onClick = action.onClick;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="ngx-gallery-arrows-wrapper ngx-gallery-arrow-left">
|
|
2
|
+
<div class="ngx-gallery-icon ngx-gallery-arrow" aria-hidden="true" (click)="handlePrevClick()"
|
|
3
|
+
[class.ngx-gallery-disabled]="prevDisabled">
|
|
4
|
+
<i class="ngx-gallery-icon-content {{arrowPrevIcon}}"></i>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="ngx-gallery-arrows-wrapper ngx-gallery-arrow-right">
|
|
8
|
+
<div class="ngx-gallery-icon ngx-gallery-arrow" aria-hidden="true" (click)="handleNextClick()"
|
|
9
|
+
[class.ngx-gallery-disabled]="nextDisabled">
|
|
10
|
+
<i class="ngx-gallery-icon-content {{arrowNextIcon}}"></i>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ngx-gallery-arrow-wrapper {
|
|
2
|
+
position: absolute;
|
|
3
|
+
height: 100%;
|
|
4
|
+
width: 1px;
|
|
5
|
+
display: table;
|
|
6
|
+
//z-index: 10001;
|
|
7
|
+
table-layout: fixed;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ngx-gallery-preview-img-wrapper {
|
|
11
|
+
.ngx-gallery-arrow-wrapper {
|
|
12
|
+
z-index: 10001;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ngx-gallery-arrow-left {
|
|
17
|
+
left: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ngx-gallery-arrow-right {
|
|
21
|
+
right: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ngx-gallery-arrow {
|
|
25
|
+
top: 50%;
|
|
26
|
+
transform: translateY(-50%);
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
|
|
29
|
+
&.ngx-gallery-disabled {
|
|
30
|
+
opacity: 0.6;
|
|
31
|
+
cursor: default;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ngx-gallery-arrow-left {
|
|
36
|
+
.ngx-gallery-arrow {
|
|
37
|
+
left: 10px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ngx-gallery-arrow-right {
|
|
42
|
+
.ngx-gallery-arrow {
|
|
43
|
+
right: 10px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NgxGalleryArrowsComponent } from './ngx-gallery-arrows.component';
|
|
4
|
+
|
|
5
|
+
describe('NgxGalleryArrowsComponent', () => {
|
|
6
|
+
let component: NgxGalleryArrowsComponent;
|
|
7
|
+
let fixture: ComponentFixture<NgxGalleryArrowsComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ NgxGalleryArrowsComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(NgxGalleryArrowsComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'ngx-gallery-arrows',
|
|
5
|
+
templateUrl: './ngx-gallery-arrows.component.html',
|
|
6
|
+
styleUrls: ['./ngx-gallery-arrows.component.scss'],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
standalone: false
|
|
9
|
+
})
|
|
10
|
+
export class NgxGalleryArrowsComponent {
|
|
11
|
+
@Input() prevDisabled: boolean;
|
|
12
|
+
@Input() nextDisabled: boolean;
|
|
13
|
+
@Input() arrowPrevIcon: string;
|
|
14
|
+
@Input() arrowNextIcon: string;
|
|
15
|
+
|
|
16
|
+
@Output() prevClick = new EventEmitter();
|
|
17
|
+
@Output() nextClick = new EventEmitter();
|
|
18
|
+
|
|
19
|
+
constructor() { }
|
|
20
|
+
|
|
21
|
+
handlePrevClick(): void {
|
|
22
|
+
this.prevClick.emit();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
handleNextClick(): void {
|
|
26
|
+
this.nextClick.emit();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: absolute;
|
|
3
|
+
z-index: 2000;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
left: 50%;
|
|
6
|
+
transform: translateX(-50%);
|
|
7
|
+
bottom: 0;
|
|
8
|
+
padding: 10px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ngx-gallery-bullet {
|
|
12
|
+
width: 10px;
|
|
13
|
+
height: 10px;
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
background: white;
|
|
17
|
+
|
|
18
|
+
&:not(:first-child) {
|
|
19
|
+
margin-left: 5px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover,
|
|
23
|
+
&.ngx-gallery-active {
|
|
24
|
+
background: black;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NgxGalleryBulletsComponent } from './ngx-gallery-bullets.component';
|
|
4
|
+
|
|
5
|
+
describe('NgxGalleryBulletsComponent', () => {
|
|
6
|
+
let component: NgxGalleryBulletsComponent;
|
|
7
|
+
let fixture: ComponentFixture<NgxGalleryBulletsComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ NgxGalleryBulletsComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(NgxGalleryBulletsComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'ngx-gallery-bullets',
|
|
5
|
+
templateUrl: './ngx-gallery-bullets.component.html',
|
|
6
|
+
styleUrls: ['./ngx-gallery-bullets.component.scss'],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
standalone: false
|
|
9
|
+
})
|
|
10
|
+
export class NgxGalleryBulletsComponent {
|
|
11
|
+
@Input() count: number;
|
|
12
|
+
@Input() active = 0;
|
|
13
|
+
|
|
14
|
+
@Output() bulletChange = new EventEmitter();
|
|
15
|
+
|
|
16
|
+
constructor() { }
|
|
17
|
+
|
|
18
|
+
getBullets(): number[] {
|
|
19
|
+
return Array(this.count);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
handleChange(event: Event, index: number): void {
|
|
23
|
+
this.bulletChange.emit(index);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<div class="ngx-gallery-image-wrapper ngx-gallery-animation-{{animation}} ngx-gallery-image-size-{{size}}">
|
|
2
|
+
@for (image of getImages(); track image; let i = $index) {
|
|
3
|
+
@if (image.type === 'image' && image.index === _selectedIndex) {
|
|
4
|
+
<div class="ngx-gallery-image" [ngClass]="{'ngx-gallery-clickable': clickable }"
|
|
5
|
+
[style.background-image]="getSafeUrl(image.src)" (click)="handleClick($event, image.index)" [@animation]="action"
|
|
6
|
+
(@animation.start)="onStart($event)" (@animation.done)="onDone($event)">
|
|
7
|
+
<div class="ngx-gallery-icons-wrapper">
|
|
8
|
+
@for (action of actions; track action) {
|
|
9
|
+
<ngx-gallery-action [icon]="action.icon" [disabled]="action.disabled" [titleText]="action.titleText"
|
|
10
|
+
(closeClick)="action.onClick($event, image.index)"></ngx-gallery-action>
|
|
11
|
+
}
|
|
12
|
+
</div>
|
|
13
|
+
@if (showDescription && descriptions[image.index]) {
|
|
14
|
+
<div class="ngx-gallery-image-text" [innerHTML]="descriptions[image.index]" (click)="$event.stopPropagation()">
|
|
15
|
+
</div>
|
|
16
|
+
}
|
|
17
|
+
</div>
|
|
18
|
+
}
|
|
19
|
+
@if (image.type === 'video' && image.index === _selectedIndex) {
|
|
20
|
+
<div class="ngx-gallery-image" [ngClass]="{'ngx-gallery-clickable': clickable }"
|
|
21
|
+
[style.background-image]="getSafeUrl(image.src)" (click)="handleClick($event, image.index)" [@animation]="action"
|
|
22
|
+
(@animation.start)="onStart($event)" (@animation.done)="onDone($event)">
|
|
23
|
+
<video controls style="width:100%; height:100%; background: #000;">
|
|
24
|
+
<source [src]="image.src">
|
|
25
|
+
Your browser does not support the video tag.
|
|
26
|
+
</video>
|
|
27
|
+
<div class="ngx-gallery-icons-wrapper">
|
|
28
|
+
@for (action of actions; track action) {
|
|
29
|
+
<ngx-gallery-action [icon]="action.icon" [disabled]="action.disabled" [titleText]="action.titleText"
|
|
30
|
+
(closeClick)="action.onClick($event, image.index)"></ngx-gallery-action>
|
|
31
|
+
}
|
|
32
|
+
</div>
|
|
33
|
+
@if (showDescription && descriptions[image.index]) {
|
|
34
|
+
<div class="ngx-gallery-image-text" [innerHTML]="descriptions[image.index]" (click)="$event.stopPropagation()">
|
|
35
|
+
</div>
|
|
36
|
+
}
|
|
37
|
+
</div>
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
@if (bullets) {
|
|
41
|
+
<ngx-gallery-bullets [count]="images.length" [active]="_selectedIndex"
|
|
42
|
+
(bulletChange)="show($event)"></ngx-gallery-bullets>
|
|
43
|
+
}
|
|
44
|
+
@if (arrows) {
|
|
45
|
+
<ngx-gallery-arrows class="ngx-gallery-image-size-{{size}}" (prevClick)="showPrev()" (nextClick)="showNext()"
|
|
46
|
+
[prevDisabled]="!canShowPrev()" [nextDisabled]="!canShowNext()" [arrowPrevIcon]="arrowPrevIcon"
|
|
47
|
+
[arrowNextIcon]="arrowNextIcon"></ngx-gallery-arrows>
|
|
48
|
+
}
|
|
49
|
+
</div>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
position: relative;
|
|
5
|
+
font-size: 25px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ngx-gallery-image-wrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: absolute;
|
|
12
|
+
left: 0;
|
|
13
|
+
top: 0;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ngx-gallery-image {
|
|
18
|
+
background-position: center;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
height: 100%;
|
|
21
|
+
width: 100%;
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
|
|
25
|
+
&.ngx-gallery-active {
|
|
26
|
+
// z-index: 1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ngx-gallery-image-size-cover .ngx-gallery-image {
|
|
31
|
+
background-size: cover;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ngx-gallery-image-size-contain .ngx-gallery-image {
|
|
35
|
+
background-size: contain;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ngx-gallery-animation-fade {
|
|
39
|
+
.ngx-gallery-image {
|
|
40
|
+
left: 0;
|
|
41
|
+
opacity: 1;
|
|
42
|
+
transition: 0.5s ease-in-out;
|
|
43
|
+
|
|
44
|
+
&.ngx-gallery-active {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ngx-gallery-animation-slide {
|
|
51
|
+
.ngx-gallery-image {
|
|
52
|
+
/*transition: 0.5s ease-in-out;
|
|
53
|
+
|
|
54
|
+
&.ngx-gallery-active {
|
|
55
|
+
transform:translateX(0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.ngx-gallery-inactive-left {
|
|
59
|
+
transform:translateX(-100%);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.ngx-gallery-inactive-right {
|
|
63
|
+
transform:translateX(100%);
|
|
64
|
+
}*/
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ngx-gallery-animation-rotate {
|
|
69
|
+
.ngx-gallery-image {
|
|
70
|
+
transition: 1s ease;
|
|
71
|
+
transform: scale(1, 1) rotate(0deg);
|
|
72
|
+
left: 0;
|
|
73
|
+
opacity: 1;
|
|
74
|
+
|
|
75
|
+
&.ngx-gallery-active {
|
|
76
|
+
//transform: scale(1, 1) rotate(0deg);
|
|
77
|
+
//opacity: 1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ngx-gallery-animation-zoom {
|
|
83
|
+
.ngx-gallery-image {
|
|
84
|
+
transition: 1s ease;
|
|
85
|
+
transform: scale(1, 1);
|
|
86
|
+
left: 0;
|
|
87
|
+
opacity: 1;
|
|
88
|
+
|
|
89
|
+
&.ngx-gallery-active {
|
|
90
|
+
//transform: scale(1, 1);
|
|
91
|
+
//opacity: 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ngx-gallery-image-text {
|
|
97
|
+
width: 100%;
|
|
98
|
+
background: rgba(0, 0, 0, 0.7);
|
|
99
|
+
padding: 10px;
|
|
100
|
+
text-align: center;
|
|
101
|
+
color: white;
|
|
102
|
+
font-size: 16px;
|
|
103
|
+
position: absolute;
|
|
104
|
+
bottom: 0;
|
|
105
|
+
z-index: 10;
|
|
106
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { NgxGalleryImageComponent } from './ngx-gallery-image.component';
|
|
4
|
+
import {NgxGalleryAction} from '../ngx-gallery-action';
|
|
5
|
+
import {NgxGalleryBulletsComponent} from '../ngx-gallery-bullets/ngx-gallery-bullets.component';
|
|
6
|
+
import {NgxGalleryArrowsComponent} from '../ngx-gallery-arrows/ngx-gallery-arrows.component';
|
|
7
|
+
import {CommonModule} from '@angular/common';
|
|
8
|
+
import {NgxGalleryService} from '../ngx-gallery.service';
|
|
9
|
+
import {DomSanitizer} from '@angular/platform-browser';
|
|
10
|
+
import {NgxGalleryActionComponent} from '../ngx-gallery-action/ngx-gallery-action.component';
|
|
11
|
+
import {Renderer2} from '@angular/core';
|
|
12
|
+
|
|
13
|
+
describe('NgxGalleryImageComponent', () => {
|
|
14
|
+
let component: NgxGalleryImageComponent;
|
|
15
|
+
let fixture: ComponentFixture<NgxGalleryImageComponent>;
|
|
16
|
+
|
|
17
|
+
beforeEach(async(() => {
|
|
18
|
+
TestBed.configureTestingModule({
|
|
19
|
+
declarations: [ NgxGalleryImageComponent, NgxGalleryActionComponent, NgxGalleryBulletsComponent, NgxGalleryArrowsComponent ],
|
|
20
|
+
imports: [],
|
|
21
|
+
providers: [Renderer2, DomSanitizer, NgxGalleryService ],
|
|
22
|
+
})
|
|
23
|
+
.compileComponents();
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
fixture = TestBed.createComponent(NgxGalleryImageComponent);
|
|
28
|
+
component = fixture.componentInstance;
|
|
29
|
+
fixture.detectChanges();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should create', () => {
|
|
33
|
+
expect(component).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
});
|