@ks89/angular-modal-gallery 10.0.1 → 11.0.0-rc.1
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/CHANGELOG.md +11 -0
- package/CONTRIBUTING.md +3 -3
- package/LICENSE +1 -1
- package/README.md +11 -14
- package/esm2022/lib/components/accessible.component.mjs +131 -0
- package/esm2022/lib/components/carousel/carousel-previews/carousel-previews.component.mjs +457 -0
- package/esm2022/lib/components/carousel/carousel.component.mjs +739 -0
- package/{esm2020 → esm2022}/lib/components/components.mjs +2 -2
- package/esm2022/lib/components/current-image/current-image.component.mjs +608 -0
- package/esm2022/lib/components/current-image/loading-spinner/loading-spinner.component.mjs +81 -0
- package/esm2022/lib/components/dots/dots.component.mjs +125 -0
- package/{esm2020 → esm2022}/lib/components/modal-gallery/modal-gallery-ref.mjs +2 -2
- package/esm2022/lib/components/modal-gallery/modal-gallery.component.mjs +500 -0
- package/esm2022/lib/components/modal-gallery/modal-gallery.service.mjs +188 -0
- package/{esm2020 → esm2022}/lib/components/modal-gallery/modal-gallery.tokens.mjs +2 -2
- package/esm2022/lib/components/plain-gallery/plain-gallery.component.mjs +250 -0
- package/esm2022/lib/components/previews/previews.component.mjs +264 -0
- package/esm2022/lib/components/upper-buttons/upper-buttons.component.mjs +244 -0
- package/esm2022/lib/directives/a-tag-bg-image.directive.mjs +79 -0
- package/esm2022/lib/directives/click-outside.directive.mjs +92 -0
- package/esm2022/lib/directives/description.directive.mjs +99 -0
- package/esm2022/lib/directives/direction.directive.mjs +74 -0
- package/esm2022/lib/directives/directives.mjs +51 -0
- package/esm2022/lib/directives/fallback-image.directive.mjs +60 -0
- package/esm2022/lib/directives/keyboard-navigation.directive.mjs +59 -0
- package/esm2022/lib/directives/margin.directive.mjs +85 -0
- package/esm2022/lib/directives/max-size.directive.mjs +76 -0
- package/esm2022/lib/directives/size.directive.mjs +77 -0
- package/esm2022/lib/directives/swipe.directive.mjs +115 -0
- package/esm2022/lib/directives/wrap.directive.mjs +75 -0
- package/esm2022/lib/modal-gallery.module.mjs +69 -0
- package/{esm2020 → esm2022}/lib/model/accessibility.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/action.enum.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/buttons-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/carousel-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/carousel-image-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/carousel-preview-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/current-image-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/description.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/dots-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/image-internal.class.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/image.class.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/keyboard-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/keyboard.enum.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/lib-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/loading-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/max-size.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/modal-gallery-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/plain-gallery-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/play-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/preview-config.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/size.interface.mjs +2 -2
- package/{esm2020 → esm2022}/lib/model/slide-config.interface.mjs +2 -2
- package/esm2022/lib/services/config.service.mjs +389 -0
- package/esm2022/lib/services/id-validator.service.mjs +72 -0
- package/{esm2020 → esm2022}/lib/utils/image.util.mjs +4 -4
- package/{esm2020 → esm2022}/lib/utils/user-input.util.mjs +2 -2
- package/{esm2020 → esm2022}/public-api.mjs +2 -2
- package/{fesm2020 → fesm2022}/ks89-angular-modal-gallery.mjs +382 -471
- package/fesm2022/ks89-angular-modal-gallery.mjs.map +1 -0
- package/lib/components/carousel/carousel-previews/carousel-previews.component.d.ts +4 -4
- package/lib/components/carousel/carousel.component.d.ts +5 -8
- package/lib/components/current-image/current-image.component.d.ts +6 -10
- package/lib/components/current-image/loading-spinner/loading-spinner.component.d.ts +3 -3
- package/lib/components/dots/dots.component.d.ts +5 -5
- package/lib/components/modal-gallery/modal-gallery.component.d.ts +11 -17
- package/lib/components/plain-gallery/plain-gallery.component.d.ts +3 -3
- package/lib/components/previews/previews.component.d.ts +6 -6
- package/lib/components/upper-buttons/upper-buttons.component.d.ts +4 -4
- package/lib/directives/a-tag-bg-image.directive.d.ts +3 -3
- package/lib/directives/click-outside.directive.d.ts +2 -2
- package/lib/directives/description.directive.d.ts +3 -3
- package/lib/directives/direction.directive.d.ts +3 -3
- package/lib/directives/directives.d.ts +2 -1
- package/lib/directives/fallback-image.directive.d.ts +1 -1
- package/lib/directives/keyboard-navigation.directive.d.ts +1 -1
- package/lib/directives/margin.directive.d.ts +3 -3
- package/lib/directives/max-size.directive.d.ts +3 -3
- package/lib/directives/size.directive.d.ts +1 -1
- package/lib/directives/swipe.directive.d.ts +33 -0
- package/lib/directives/wrap.directive.d.ts +3 -3
- package/lib/modal-gallery.module.d.ts +4 -10
- package/lib/model/keyboard.enum.d.ts +1 -1
- package/lib/model/lib-config.interface.d.ts +2 -6
- package/lib/services/config.service.d.ts +0 -2
- package/lib/utils/image.util.d.ts +2 -2
- package/package.json +10 -18
- package/esm2020/lib/components/accessible.component.mjs +0 -130
- package/esm2020/lib/components/carousel/carousel-previews/carousel-previews.component.mjs +0 -462
- package/esm2020/lib/components/carousel/carousel.component.mjs +0 -747
- package/esm2020/lib/components/current-image/current-image.component.mjs +0 -616
- package/esm2020/lib/components/current-image/loading-spinner/loading-spinner.component.mjs +0 -80
- package/esm2020/lib/components/dots/dots.component.mjs +0 -127
- package/esm2020/lib/components/modal-gallery/modal-gallery.component.mjs +0 -524
- package/esm2020/lib/components/modal-gallery/modal-gallery.service.mjs +0 -187
- package/esm2020/lib/components/plain-gallery/plain-gallery.component.mjs +0 -249
- package/esm2020/lib/components/previews/previews.component.mjs +0 -272
- package/esm2020/lib/components/upper-buttons/upper-buttons.component.mjs +0 -249
- package/esm2020/lib/directives/a-tag-bg-image.directive.mjs +0 -78
- package/esm2020/lib/directives/click-outside.directive.mjs +0 -91
- package/esm2020/lib/directives/description.directive.mjs +0 -98
- package/esm2020/lib/directives/direction.directive.mjs +0 -73
- package/esm2020/lib/directives/directives.mjs +0 -49
- package/esm2020/lib/directives/fallback-image.directive.mjs +0 -59
- package/esm2020/lib/directives/keyboard-navigation.directive.mjs +0 -58
- package/esm2020/lib/directives/margin.directive.mjs +0 -84
- package/esm2020/lib/directives/max-size.directive.mjs +0 -75
- package/esm2020/lib/directives/size.directive.mjs +0 -76
- package/esm2020/lib/directives/wrap.directive.mjs +0 -74
- package/esm2020/lib/modal-gallery.module.mjs +0 -94
- package/esm2020/lib/model/keyboard-service-config.interface.mjs +0 -25
- package/esm2020/lib/services/config.service.mjs +0 -396
- package/esm2020/lib/services/id-validator.service.mjs +0 -71
- package/esm2020/lib/services/keyboard.service.mjs +0 -111
- package/fesm2015/ks89-angular-modal-gallery.mjs +0 -5728
- package/fesm2015/ks89-angular-modal-gallery.mjs.map +0 -1
- package/fesm2020/ks89-angular-modal-gallery.mjs.map +0 -1
- package/lib/model/keyboard-service-config.interface.d.ts +0 -8
- package/lib/services/keyboard.service.d.ts +0 -26
- /package/{esm2020 → esm2022}/ks89-angular-modal-gallery.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/accessibility-default.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/components/upper-buttons/upper-buttons-default.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/model/interaction-event.interface.mjs +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="hammerjs" />
|
|
2
|
-
import { HammerGestureConfig } from '@angular/platform-browser';
|
|
3
1
|
import * as i0 from "@angular/core";
|
|
4
2
|
import * as i1 from "./components/plain-gallery/plain-gallery.component";
|
|
5
3
|
import * as i2 from "./components/carousel/carousel.component";
|
|
@@ -21,18 +19,14 @@ import * as i17 from "./directives/description.directive";
|
|
|
21
19
|
import * as i18 from "./directives/margin.directive";
|
|
22
20
|
import * as i19 from "./directives/max-size.directive";
|
|
23
21
|
import * as i20 from "./directives/fallback-image.directive";
|
|
24
|
-
import * as i21 from "
|
|
25
|
-
import * as i22 from "@angular/
|
|
26
|
-
|
|
27
|
-
buildHammer(element: HTMLElement): HammerManager;
|
|
28
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<KsHammerGestureConfig, never>;
|
|
29
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<KsHammerGestureConfig>;
|
|
30
|
-
}
|
|
22
|
+
import * as i21 from "./directives/swipe.directive";
|
|
23
|
+
import * as i22 from "@angular/common";
|
|
24
|
+
import * as i23 from "@angular/cdk/overlay";
|
|
31
25
|
/**
|
|
32
26
|
* Module to import it in the root module of your application.
|
|
33
27
|
*/
|
|
34
28
|
export declare class GalleryModule {
|
|
35
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<GalleryModule, never>;
|
|
36
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<GalleryModule, [typeof i1.PlainGalleryComponent, typeof i2.CarouselComponent, typeof i3.CarouselPreviewsComponent, typeof i4.UpperButtonsComponent, typeof i5.DotsComponent, typeof i6.PreviewsComponent, typeof i7.CurrentImageComponent, typeof i8.LoadingSpinnerComponent, typeof i9.AccessibleComponent, typeof i10.ModalGalleryComponent, typeof i11.ClickOutsideDirective, typeof i12.SizeDirective, typeof i13.KeyboardNavigationDirective, typeof i14.WrapDirective, typeof i15.DirectionDirective, typeof i16.ATagBgImageDirective, typeof i17.DescriptionDirective, typeof i18.MarginDirective, typeof i19.MaxSizeDirective, typeof i20.FallbackImageDirective], [typeof
|
|
30
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<GalleryModule, [typeof i1.PlainGalleryComponent, typeof i2.CarouselComponent, typeof i3.CarouselPreviewsComponent, typeof i4.UpperButtonsComponent, typeof i5.DotsComponent, typeof i6.PreviewsComponent, typeof i7.CurrentImageComponent, typeof i8.LoadingSpinnerComponent, typeof i9.AccessibleComponent, typeof i10.ModalGalleryComponent, typeof i11.ClickOutsideDirective, typeof i12.SizeDirective, typeof i13.KeyboardNavigationDirective, typeof i14.WrapDirective, typeof i15.DirectionDirective, typeof i16.ATagBgImageDirective, typeof i17.DescriptionDirective, typeof i18.MarginDirective, typeof i19.MaxSizeDirective, typeof i20.FallbackImageDirective, typeof i21.SwipeDirective], [typeof i22.CommonModule, typeof i23.OverlayModule], [typeof i1.PlainGalleryComponent, typeof i2.CarouselComponent]>;
|
|
37
31
|
static ɵinj: i0.ɵɵInjectorDeclaration<GalleryModule>;
|
|
38
32
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Enum `Keyboard` with keys and their relative codes.
|
|
3
3
|
*/
|
|
4
4
|
import { DOWN_ARROW_CODE, ESC_CODE, LEFT_ARROW_CODE, RIGHT_ARROW_CODE, UP_ARROW_CODE } from '../utils/user-input.util';
|
|
5
|
-
|
|
5
|
+
type Keyboard = Readonly<{
|
|
6
6
|
ESC: typeof ESC_CODE;
|
|
7
7
|
LEFT_ARROW: typeof LEFT_ARROW_CODE;
|
|
8
8
|
RIGHT_ARROW: typeof RIGHT_ARROW_CODE;
|
|
@@ -10,7 +10,6 @@ import { CarouselConfig } from './carousel-config.interface';
|
|
|
10
10
|
import { CarouselImageConfig } from './carousel-image-config.interface';
|
|
11
11
|
import { CarouselPreviewConfig } from './carousel-preview-config.interface';
|
|
12
12
|
import { PlayConfig } from './play-config.interface';
|
|
13
|
-
import { KeyboardServiceConfig } from './keyboard-service-config.interface';
|
|
14
13
|
export interface AccessibleLibConfig {
|
|
15
14
|
accessibilityConfig?: AccessibilityConfig;
|
|
16
15
|
}
|
|
@@ -19,10 +18,7 @@ export interface CommonLibConfig {
|
|
|
19
18
|
dotsConfig?: DotsConfig;
|
|
20
19
|
slideConfig?: SlideConfig;
|
|
21
20
|
}
|
|
22
|
-
export interface
|
|
23
|
-
keyboardServiceConfig?: KeyboardServiceConfig;
|
|
24
|
-
}
|
|
25
|
-
export interface CarouselLibConfig extends CommonLibConfig, AccessibleLibConfig, KeyboardServiceLibConfig {
|
|
21
|
+
export interface CarouselLibConfig extends CommonLibConfig, AccessibleLibConfig {
|
|
26
22
|
carouselConfig?: CarouselConfig;
|
|
27
23
|
carouselImageConfig?: CarouselImageConfig;
|
|
28
24
|
carouselPreviewsConfig?: CarouselPreviewConfig;
|
|
@@ -30,7 +26,7 @@ export interface CarouselLibConfig extends CommonLibConfig, AccessibleLibConfig,
|
|
|
30
26
|
carouselDotsConfig?: DotsConfig;
|
|
31
27
|
carouselSlideInfinite?: boolean;
|
|
32
28
|
}
|
|
33
|
-
export interface ModalLibConfig extends CommonLibConfig, AccessibleLibConfig
|
|
29
|
+
export interface ModalLibConfig extends CommonLibConfig, AccessibleLibConfig {
|
|
34
30
|
enableCloseOutside?: boolean;
|
|
35
31
|
keyboardConfig?: KeyboardConfig;
|
|
36
32
|
currentImageConfig?: CurrentImageConfig;
|
|
@@ -9,7 +9,6 @@ import { Description, DescriptionStyle } from '../model/description.interface';
|
|
|
9
9
|
import { CarouselConfig } from '../model/carousel-config.interface';
|
|
10
10
|
import { CarouselImageConfig } from '../model/carousel-image-config.interface';
|
|
11
11
|
import { BreakpointsConfig, CarouselPreviewConfig } from '../model/carousel-preview-config.interface';
|
|
12
|
-
import { KeyboardServiceConfig } from '../model/keyboard-service-config.interface';
|
|
13
12
|
import { LibConfig } from '../model/lib-config.interface';
|
|
14
13
|
import * as i0 from "@angular/core";
|
|
15
14
|
export declare const DEFAULT_PREVIEW_SIZE: Size;
|
|
@@ -25,7 +24,6 @@ export declare const DEFAULT_CURRENT_CAROUSEL_CONFIG: CarouselConfig;
|
|
|
25
24
|
export declare const DEFAULT_CURRENT_CAROUSEL_PLAY: PlayConfig;
|
|
26
25
|
export declare const DEFAULT_CAROUSEL_BREAKPOINTS: BreakpointsConfig;
|
|
27
26
|
export declare const DEFAULT_CAROUSEL_PREVIEWS_CONFIG: CarouselPreviewConfig;
|
|
28
|
-
export declare const DEFAULT_KEYBOARD_SERVICE_CONFIG: KeyboardServiceConfig;
|
|
29
27
|
export declare const DEFAULT_SLIDE_CONFIG: SlideConfig;
|
|
30
28
|
export declare const DEFAULT_PREVIEW_CONFIG: PreviewConfig;
|
|
31
29
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Image } from '../model/image.class';
|
|
2
2
|
/**
|
|
3
3
|
* Utility function to get the index of the input `image` from `arrayOfImages`
|
|
4
|
-
* @param Image
|
|
5
|
-
* @param Image[]
|
|
4
|
+
* @param image Image to get the index. The image 'id' must be a number >= 0
|
|
5
|
+
* @param arrayOfImages Image[] to search the image within it
|
|
6
6
|
* @returns number the index of the image. -1 if not found.
|
|
7
7
|
* @throws an Error if either image or arrayOfImages are not valid,
|
|
8
8
|
* or if the input image doesn't contain an 'id', or the 'id' is < 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ks89/angular-modal-gallery",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-rc.1",
|
|
4
4
|
"description": "Image gallery for Angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Stefano Cappa",
|
|
@@ -8,17 +8,15 @@
|
|
|
8
8
|
"node": ">=18.12.1",
|
|
9
9
|
"npm": ">=8.19.2"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://ks89.github.io/angular-modal-gallery-
|
|
11
|
+
"homepage": "https://ks89.github.io/angular-modal-gallery-2023-v11.github.io/",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"tslib": ">=2.3.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@angular/platform-browser": ">=
|
|
17
|
-
"@angular/common": ">=
|
|
18
|
-
"@angular/core": ">=
|
|
19
|
-
"@angular/cdk": ">=
|
|
20
|
-
"hammerjs": ">=2.0.8",
|
|
21
|
-
"mousetrap": ">=1.6.5",
|
|
16
|
+
"@angular/platform-browser": ">=16.0.0",
|
|
17
|
+
"@angular/common": ">=16.0.0",
|
|
18
|
+
"@angular/core": ">=16.0.0",
|
|
19
|
+
"@angular/cdk": ">=16.0.0",
|
|
22
20
|
"rxjs": ">=7.5.0"
|
|
23
21
|
},
|
|
24
22
|
"keywords": [
|
|
@@ -54,11 +52,7 @@
|
|
|
54
52
|
"bugs": {
|
|
55
53
|
"url": "https://github.com/Ks89/angular-modal-gallery/issues"
|
|
56
54
|
},
|
|
57
|
-
"module": "
|
|
58
|
-
"es2020": "fesm2020/ks89-angular-modal-gallery.mjs",
|
|
59
|
-
"esm2020": "esm2020/ks89-angular-modal-gallery.mjs",
|
|
60
|
-
"fesm2020": "fesm2020/ks89-angular-modal-gallery.mjs",
|
|
61
|
-
"fesm2015": "fesm2015/ks89-angular-modal-gallery.mjs",
|
|
55
|
+
"module": "fesm2022/ks89-angular-modal-gallery.mjs",
|
|
62
56
|
"typings": "index.d.ts",
|
|
63
57
|
"exports": {
|
|
64
58
|
"./package.json": {
|
|
@@ -66,11 +60,9 @@
|
|
|
66
60
|
},
|
|
67
61
|
".": {
|
|
68
62
|
"types": "./index.d.ts",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"node": "./fesm2015/ks89-angular-modal-gallery.mjs",
|
|
73
|
-
"default": "./fesm2020/ks89-angular-modal-gallery.mjs"
|
|
63
|
+
"esm2022": "./esm2022/ks89-angular-modal-gallery.mjs",
|
|
64
|
+
"esm": "./esm2022/ks89-angular-modal-gallery.mjs",
|
|
65
|
+
"default": "./fesm2022/ks89-angular-modal-gallery.mjs"
|
|
74
66
|
}
|
|
75
67
|
},
|
|
76
68
|
"sideEffects": false
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
The MIT License (MIT)
|
|
3
|
-
|
|
4
|
-
Copyright (C) 2017-2022 Stefano Cappa (Ks89)
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
25
|
-
import { DIRECTION_RIGHT, MOUSE_MAIN_BUTTON_CLICK, NEXT, NOTHING, PREV, ENTER_CODE, SPACE_CODE } from '../utils/user-input.util';
|
|
26
|
-
import * as i0 from "@angular/core";
|
|
27
|
-
/**
|
|
28
|
-
* Provides some useful methods to add accessibility features to subclasses.
|
|
29
|
-
* In particular, it exposes a method to handle navigation event with both Keyboard and Mouse
|
|
30
|
-
* and another with also the direction (right or left).
|
|
31
|
-
*/
|
|
32
|
-
export class AccessibleComponent {
|
|
33
|
-
constructor() { }
|
|
34
|
-
/**
|
|
35
|
-
* Method to handle navigation events with both Keyboard and Mouse.
|
|
36
|
-
* @param string direction of the navigation that can be either 'next' or 'prev'
|
|
37
|
-
* @param KeyboardEvent | MouseEvent event payload
|
|
38
|
-
* @returns number -1 for PREV, 1 for NEXT and 0 for NOTHING
|
|
39
|
-
*/
|
|
40
|
-
handleNavigationEvent(direction, event) {
|
|
41
|
-
if (!event) {
|
|
42
|
-
return NOTHING;
|
|
43
|
-
}
|
|
44
|
-
if (event instanceof KeyboardEvent) {
|
|
45
|
-
return this.handleKeyboardNavigationEvent(direction, event);
|
|
46
|
-
}
|
|
47
|
-
else if (event instanceof MouseEvent) {
|
|
48
|
-
return this.handleMouseNavigationEvent(direction, event);
|
|
49
|
-
}
|
|
50
|
-
return NOTHING;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Method to handle events over an image, for instance a keypress with the Keyboard or a Mouse click.
|
|
54
|
-
* @param event KeyboardEvent | MouseEvent payload
|
|
55
|
-
* @returns number 1 for NEXT and 0 for NOTHING
|
|
56
|
-
*/
|
|
57
|
-
handleImageEvent(event) {
|
|
58
|
-
if (!event) {
|
|
59
|
-
return NOTHING;
|
|
60
|
-
}
|
|
61
|
-
if (event instanceof KeyboardEvent) {
|
|
62
|
-
return this.handleImageKeyboardEvent(event);
|
|
63
|
-
}
|
|
64
|
-
else if (event instanceof MouseEvent) {
|
|
65
|
-
return this.handleImageMouseEvent(event);
|
|
66
|
-
}
|
|
67
|
-
return NOTHING;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Private method to handle keyboard events over an image.
|
|
71
|
-
* @param event KeyboardEvent payload
|
|
72
|
-
* @returns number 1 for NEXT and 0 for NOTHING
|
|
73
|
-
*/
|
|
74
|
-
handleImageKeyboardEvent(event) {
|
|
75
|
-
const key = event.code;
|
|
76
|
-
if (key === SPACE_CODE || key === ENTER_CODE) {
|
|
77
|
-
return NEXT;
|
|
78
|
-
}
|
|
79
|
-
return NOTHING;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Private method to handle mouse events over an image.
|
|
83
|
-
* @param MouseEvent event payload
|
|
84
|
-
* @returns number 1 for NEXT and 0 for NOTHING
|
|
85
|
-
*/
|
|
86
|
-
handleImageMouseEvent(event) {
|
|
87
|
-
const mouseBtn = event.button;
|
|
88
|
-
if (mouseBtn === MOUSE_MAIN_BUTTON_CLICK) {
|
|
89
|
-
return NEXT;
|
|
90
|
-
}
|
|
91
|
-
return NOTHING;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Method to handle events over an image, for instance a keypress with the Keyboard or a Mouse click.
|
|
95
|
-
* @param string direction of the navigation that can be either 'next' or 'prev'
|
|
96
|
-
* @param KeyboardEvent event payload
|
|
97
|
-
* @returns number -1 for PREV, 1 for NEXT and 0 for NOTHING
|
|
98
|
-
*/
|
|
99
|
-
handleKeyboardNavigationEvent(direction, event) {
|
|
100
|
-
const key = event.code;
|
|
101
|
-
if (key === SPACE_CODE || key === ENTER_CODE) {
|
|
102
|
-
return direction === DIRECTION_RIGHT ? NEXT : PREV;
|
|
103
|
-
}
|
|
104
|
-
return NOTHING;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Method to handle events over an image, for instance a keypress with the Keyboard or a Mouse click.
|
|
108
|
-
* @param string direction of the navigation that can be either 'next' or 'prev'
|
|
109
|
-
* @param MouseEvent event payload
|
|
110
|
-
* @returns number -1 for PREV, 1 for NEXT and 0 for NOTHING
|
|
111
|
-
*/
|
|
112
|
-
handleMouseNavigationEvent(direction, event) {
|
|
113
|
-
const mouseBtn = event.button;
|
|
114
|
-
if (mouseBtn === MOUSE_MAIN_BUTTON_CLICK) {
|
|
115
|
-
return direction === DIRECTION_RIGHT ? NEXT : PREV;
|
|
116
|
-
}
|
|
117
|
-
return NOTHING;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
AccessibleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: AccessibleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
121
|
-
AccessibleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: AccessibleComponent, selector: "ks-accessible", ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
122
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: AccessibleComponent, decorators: [{
|
|
123
|
-
type: Component,
|
|
124
|
-
args: [{
|
|
125
|
-
selector: 'ks-accessible',
|
|
126
|
-
template: ``,
|
|
127
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
128
|
-
}]
|
|
129
|
-
}], ctorParameters: function () { return []; } });
|
|
130
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzaWJsZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9rczg5L2FuZ3VsYXItbW9kYWwtZ2FsbGVyeS9zcmMvbGliL2NvbXBvbmVudHMvYWNjZXNzaWJsZS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FzQkc7QUFFSCxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRW5FLE9BQU8sRUFBRSxlQUFlLEVBQUUsdUJBQXVCLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxJQUFJ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