rm-image-slider 0.0.0-watch
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/README.md +184 -0
- package/esm2022/lib/interface.mjs +2 -0
- package/esm2022/lib/rm-image-slider.component.mjs +541 -0
- package/esm2022/lib/rm-image-slider.service.mjs +69 -0
- package/esm2022/lib/slider-custom-image/slider-custom-image.component.mjs +125 -0
- package/esm2022/lib/slider-lightbox/slider-lightbox.component.mjs +246 -0
- package/esm2022/public-api.mjs +7 -0
- package/esm2022/rm-image-slider.mjs +5 -0
- package/fesm2022/rm-image-slider.mjs +976 -0
- package/fesm2022/rm-image-slider.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/interface.d.ts +10 -0
- package/lib/rm-image-slider.component.d.ts +92 -0
- package/lib/rm-image-slider.service.d.ts +9 -0
- package/lib/slider-custom-image/slider-custom-image.component.d.ts +34 -0
- package/lib/slider-lightbox/slider-lightbox.component.d.ts +56 -0
- package/package.json +54 -0
- package/public-api.d.ts +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<a href="https://github.com/malikrajat/rm-image-slider">
|
|
2
|
+
<h1 align="center">Image Slider/ carousel</h1>
|
|
3
|
+
<p align="center">Advanced, customizable, Optimized ,Minimal, light-weight and fully customizable pure angular component for carousel.</p>
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/rm-image-slider)
|
|
7
|
+
[](https://github.com/malikrajat/rm-image-slider)
|
|
8
|
+
|
|
9
|
+
__
|
|
10
|
+
# Angular Image Slider with Lightbox
|
|
11
|
+
|
|
12
|
+
An Angular responsive image slider with lightbox popup.
|
|
13
|
+
Also support youtube and mp4 video urls. It is leazy loading and heigly optimized with standalone component.
|
|
14
|
+
|
|
15
|
+
(Compatible with Angular Version: 17)
|
|
16
|
+
|
|
17
|
+
## Features!
|
|
18
|
+
|
|
19
|
+
- Responsive (support images width and height in both % and px)
|
|
20
|
+
- captures swipes from phones and tablets
|
|
21
|
+
- Compatible with Angular Universal
|
|
22
|
+
- Image lightbox popup
|
|
23
|
+
- captures keyboard next/previous arrow key event for lightbox image move
|
|
24
|
+
- Support Images (jpeg, jpg, gif, png and Base64-String), Youtube url and MP4 video (url and Base64-String)
|
|
25
|
+
- Handling runtime image arraylist changes
|
|
26
|
+
|
|
27
|
+
# Installation
|
|
28
|
+
|
|
29
|
+
Install rm-image-slider with npm amd yarn
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
|
|
33
|
+
npm: npm install rm-image-slider--save
|
|
34
|
+
|
|
35
|
+
yarn: yarn add rm-image-slider
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
# Setup :
|
|
40
|
+
|
|
41
|
+
**Import module in your component:**
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { RmImageSliderComponent, ImageObject } from 'rm-image-slider';
|
|
45
|
+
...
|
|
46
|
+
@Component({
|
|
47
|
+
selector: '',
|
|
48
|
+
standalone: true,
|
|
49
|
+
imports: [RmImageSliderComponent],
|
|
50
|
+
templateUrl: '',
|
|
51
|
+
styleUrl: '',
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Add component in your template file.**
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<rm-image-slider [images]="imageObject" #nav></rm-image-slider>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**ImageObject format**
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
imageObject: Array<ImageObject> = [{
|
|
66
|
+
image: 'assets/img/slider/1.jpg',
|
|
67
|
+
thumbImage: 'assets/img/slider/1_min.jpeg',
|
|
68
|
+
alt: 'alt of image',
|
|
69
|
+
title: 'title of image',
|
|
70
|
+
index: 1
|
|
71
|
+
}, {
|
|
72
|
+
image: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
|
|
73
|
+
thumbImage: '.../iOe/xHHf4nf8AE75h3j1x64ZmZ//Z==', // Support base64 image
|
|
74
|
+
title: 'Image title', //Optional: You can use this key if want to show image with title
|
|
75
|
+
alt: 'Image alt', //Optional: You can use this key if want to show image with alt
|
|
76
|
+
order: 1, //Optional: if you pass this key then slider images will be arrange according @input: slideOrderType
|
|
77
|
+
index: 2
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Image, Youtube and MP4 url's object format**
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
imageObject: Array<ImageObject> = [{
|
|
86
|
+
video: 'https://youtu.be/....' // Youtube url
|
|
87
|
+
index: 1
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
video: 'assets/video/********.mp4', // MP4 Video url
|
|
91
|
+
index: 2
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
video: 'assets/video/movie2.mp4',
|
|
95
|
+
posterImage: 'assets/img/slider/2_min.jpeg', //Optional: You can use this key if you want to show video poster image in slider
|
|
96
|
+
title: 'Image title',
|
|
97
|
+
index: 3
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
image: 'assets/img/slider/1.jpg',
|
|
101
|
+
thumbImage: 'assets/img/slider/1_min.jpeg',
|
|
102
|
+
alt: 'Image alt',
|
|
103
|
+
index: 4
|
|
104
|
+
}
|
|
105
|
+
...
|
|
106
|
+
];
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## API Reference (optional) :
|
|
110
|
+
|
|
111
|
+
| Name | Type | Data Type | Description | Default |
|
|
112
|
+
| ------------------ | ------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
|
|
113
|
+
| infinite | @Input | boolean | Infinite sliding images if value is **true**. | false |
|
|
114
|
+
| imagePopup | @Input | boolean | Enable image lightBox popup option on slider image click. | true |
|
|
115
|
+
| animationSpeed | @Input | number | By this user can set slider animation speed. Minimum value is **0.1 second** and Maximum value is **5 second**. | 1 |
|
|
116
|
+
| slideImage | @Input | number | Set how many images will move on left/right arrow click. | 1 |
|
|
117
|
+
| imageSize | @Input | object | Set slider images width, height and space. space is use for set space between slider images. Pass object like `{width: '400px', height: '300px', space: 4}` or you can pass value in percentage `{width: '20%', height: '20%'}` OR set only space `{space: 4}` | `{width: 205, height: 200, space: 3}` |
|
|
118
|
+
| manageImageRatio | @Input | boolean | Show images with aspect ratio if value is `true` and set imageSize width and height on parent div | false |
|
|
119
|
+
| autoSlide | @Input | number/boolean/object | Auto slide images according provided time interval. Option will work only if **infinite** option is **true**. For number data type minimum value is 1 second and Maximum value is 5 second. By object data type you can prevent auto slide stop behaviour on mouse hover event. `{interval: 2, stopOnHover: false}` | 0 |
|
|
120
|
+
| showArrow | @Input | boolean | Hide/Show slider arrow buttons | true |
|
|
121
|
+
| arrowKeyMove | @Input | boolean | Disable slider and popup image left/right move on arrow key press event, if value is `false` | true |
|
|
122
|
+
| videoAutoPlay | @Input | boolean | Auto play popup video | false |
|
|
123
|
+
| showVideoControls | @Input | boolean | Hide video control if value is `false` | true |
|
|
124
|
+
| direction | @Input | string | Set text direction. You can pass **rtl** / **ltr** / **auto** | ltr |
|
|
125
|
+
| slideOrderType | @Input | string | Arrange slider images in Ascending order by `ASC` and in Descending order by `DESC`. `order` key must be exist with image object. | ASC |
|
|
126
|
+
| lazyLoading | @Input | boolean | Lazy load images and Iframe if true. | false |
|
|
127
|
+
| defaultActiveImage | @Input | number | Set image as selected on load. | null |
|
|
128
|
+
| imageClick | @Output | n/a | Executes when click event on slider image. Return image index. | n/a |
|
|
129
|
+
| arrowClick | @Output | n/a | Executes when click on slider left/right arrow. Returns current event name and next/previous button disabled status. | n/a |
|
|
130
|
+
| lightboxClose | @Output | n/a | Executes when lightbox close. | n/a |
|
|
131
|
+
| lightboxArrowClick | @Output | n/a | Executes when click on lightbox next/previous arrow. | n/a |
|
|
132
|
+
|
|
133
|
+
## Add custom navigation button
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { RmImageSliderComponent } from 'rm-image-slider';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
selector: 'sample',
|
|
140
|
+
standalone: true,
|
|
141
|
+
imports: [RmImageSliderComponent],
|
|
142
|
+
template:`
|
|
143
|
+
<rm-image-slider [images]="imageObject" #nav>
|
|
144
|
+
</rm-image-slider>
|
|
145
|
+
<button (click)="prevImageClick()">Prev</button>
|
|
146
|
+
<button (click)="nextImageClick()">Next</button>
|
|
147
|
+
`
|
|
148
|
+
})
|
|
149
|
+
class Sample {
|
|
150
|
+
@ViewChild('nav') slider: RmImageSliderComponent;
|
|
151
|
+
imageObject = [{...}]
|
|
152
|
+
|
|
153
|
+
prevImageClick() {
|
|
154
|
+
this.slider.prev();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
nextImageClick() {
|
|
158
|
+
this.slider.next();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
<a name="issues"/>
|
|
163
|
+
|
|
164
|
+
## Issues
|
|
165
|
+
|
|
166
|
+
If you identify any errors in this component, or have an idea for an improvement, please open
|
|
167
|
+
an [issue](https://github.com/malikrajat/rm-image-slider/issues). I am excited to see what the community thinks of this
|
|
168
|
+
project, and I would love your input!
|
|
169
|
+
|
|
170
|
+
## Author services
|
|
171
|
+
|
|
172
|
+
Are you interested in this library but lacks features? Write to the author, he can do it for you.
|
|
173
|
+
|
|
174
|
+
## Credits
|
|
175
|
+
|
|
176
|
+
The library is inspired by one other library.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<a name="author"/>
|
|
180
|
+
|
|
181
|
+
## Author
|
|
182
|
+
|
|
183
|
+
**Rajat Malik**
|
|
184
|
+
- [github/malikrajat](https://github.com/malikrajat)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvcm0taW1hZ2Utc2xpZGVyL3NyYy9saWIvaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIEltYWdlT2JqZWN0IHtcclxuICBpbWFnZT86IHN0cmluZztcclxuICB0aHVtYkltYWdlPzogc3RyaW5nO1xyXG4gIGFsdD86IHN0cmluZztcclxuICB0aXRsZT86IHN0cmluZztcclxuICBvcmRlcj86IG51bWJlcjtcclxuICBpbmRleDogbnVtYmVyO1xyXG4gIHBvc3RlckltYWdlPzogc3RyaW5nO1xyXG4gIHZpZGVvPzogc3RyaW5nO1xyXG59XHJcbiJdfQ==
|