nextalys-carousel 0.0.52 → 0.0.55

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 CHANGED
File without changes
@@ -1,8 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/common'), require('nextalys-js-helpers/dist/events'), require('@angular/material/button'), require('@angular/material/icon'), require('@angular/cdk/observers')) :
3
- typeof define === 'function' && define.amd ? define('nextalys-carousel', ['exports', '@angular/core', '@angular/material/dialog', '@angular/common', 'nextalys-js-helpers/dist/events', '@angular/material/button', '@angular/material/icon', '@angular/cdk/observers'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['nextalys-carousel'] = {}, global.ng.core, global.ng.material.dialog, global.ng.common, global.events, global.ng.material.button, global.ng.material.icon, global.ng.cdk.observers));
5
- }(this, (function (exports, core, dialog, common, events, button, icon, observers) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/common'), require('nextalys-js-helpers/dist/events'), require('swiper'), require('@angular/material/button'), require('@angular/material/icon'), require('swiper/angular')) :
3
+ typeof define === 'function' && define.amd ? define('nextalys-carousel', ['exports', '@angular/core', '@angular/material/dialog', '@angular/common', 'nextalys-js-helpers/dist/events', 'swiper', '@angular/material/button', '@angular/material/icon', 'swiper/angular'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['nextalys-carousel'] = {}, global.ng.core, global.ng.material.dialog, global.ng.common, global.events, global.swiper, global.ng.material.button, global.ng.material.icon, global.angular));
5
+ }(this, (function (exports, core, dialog, common, events, SwiperCore, button, icon, angular) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var SwiperCore__default = /*#__PURE__*/_interopDefaultLegacy(SwiperCore);
6
10
 
7
11
  /*! *****************************************************************************
8
12
  Copyright (c) Microsoft Corporation.
@@ -352,16 +356,29 @@
352
356
  { type: dialog.MatDialogRef }
353
357
  ]; };
354
358
 
359
+ var NxsSwiperTemplateDirective = /** @class */ (function () {
360
+ function NxsSwiperTemplateDirective() {
361
+ }
362
+ return NxsSwiperTemplateDirective;
363
+ }());
364
+ NxsSwiperTemplateDirective.decorators = [
365
+ { type: core.Directive, args: [{
366
+ selector: '[nxsSwiperTemplate]',
367
+ },] }
368
+ ];
369
+
370
+ // install Swiper modules
371
+ SwiperCore__default['default'].use([SwiperCore.Navigation, SwiperCore.Pagination, SwiperCore.Autoplay, SwiperCore.Lazy, SwiperCore.Thumbs]);
355
372
  var NxsCarouselComponent = /** @class */ (function () {
356
373
  function NxsCarouselComponent(matDialog, zone, platformId, config) {
357
374
  this.matDialog = matDialog;
358
375
  this.zone = zone;
359
376
  this.platformId = platformId;
360
377
  this.config = config;
361
- this.mutationObserver = null;
362
- this.recreateSliderSubscribed = false;
378
+ this.lazy = true;
363
379
  this.eventsCollector = new events.EventsCollector();
364
- this.options = {};
380
+ this.options = null;
381
+ this.thumbnailsOptions = null;
365
382
  this.hasHtmlContent = false;
366
383
  this.slidesCount = 0;
367
384
  this.slideChange = new core.EventEmitter();
@@ -377,15 +394,7 @@
377
394
  Object.defineProperty(NxsCarouselComponent.prototype, "setOptions", {
378
395
  set: function (val) {
379
396
  this.options = this.setDefaultOptions(val, false);
380
- },
381
- enumerable: false,
382
- configurable: true
383
- });
384
- Object.defineProperty(NxsCarouselComponent.prototype, "setImages", {
385
- set: function (val) {
386
- this.images = val;
387
- this.initSlides();
388
- this.createSlider(true);
397
+ this.setThumbnailsOptions();
389
398
  },
390
399
  enumerable: false,
391
400
  configurable: true
@@ -399,120 +408,20 @@
399
408
  return;
400
409
  console.log.apply(console, __spreadArray(['[NxsCarousel]'], __read(args)));
401
410
  };
402
- NxsCarouselComponent.prototype.onContentChange = function (changes) {
403
- // console.log("Log: NxsCarouselComponent -> onContentChange -> changes", changes);
404
- // changes.forEach(change => console.log(change.target));
405
- };
406
- NxsCarouselComponent.prototype.initSlides = function () {
407
- var _this = this;
411
+ NxsCarouselComponent.prototype.destroy = function () {
412
+ var _a;
408
413
  if (!this.isBrowser) {
409
- this.log('prevent initSlides on platform server');
410
- return;
411
- }
412
- if (!this.nxsSlidesWrapper) {
413
- this.log('can not initSlides : nxsSlidesWrapper is not defined !');
414
414
  return;
415
415
  }
416
- this.log('initSlides begins');
417
- this.zone.runOutsideAngular(function () {
418
- if (!_this.hasHtmlContent && _this.images) {
419
- _this.nxsSlidesWrapper.nativeElement.innerHTML = '';
420
- for (var i = 0; i < _this.images.length; i++) {
421
- var div = document.createElement('div');
422
- div.className = 'swiper-slide';
423
- div.style.backgroundImage = 'url(' + _this.images[i].src + ')';
424
- if (_this.options.nxsCarouselImageBackgroundSize)
425
- div.style.backgroundSize = _this.options.nxsCarouselImageBackgroundSize;
426
- _this.nxsSlidesWrapper.nativeElement.appendChild(div);
427
- }
428
- _this.slidesCount = _this.images.length;
429
- if (!!_this.options.nxsThumbnails && _this.options.nxsThumbnails.show) {
430
- _this.nxsThumbnailsSlidesWrapper.nativeElement.innerHTML = '';
431
- for (var i = 0; i < _this.images.length; i++) {
432
- var div = document.createElement('div');
433
- div.className = 'swiper-slide';
434
- div.style.backgroundImage = 'url(' + _this.images[i].src + ')';
435
- _this.nxsThumbnailsSlidesWrapper.nativeElement.appendChild(div);
436
- }
437
- }
438
- _this.log('initSlides - images are defined - slides count => ', _this.slidesCount);
439
- }
440
- else if (_this.hasHtmlContent) {
441
- _this.log('initSlides - html content - slides length => ', _this.nxsSlidesWrapper.nativeElement.children.length);
442
- for (var i = 0; i < _this.nxsSlidesWrapper.nativeElement.children.length; i++) {
443
- var child = _this.nxsSlidesWrapper.nativeElement.children[i];
444
- if (!child.className)
445
- child.className = 'swiper-slide';
446
- else if (child.className.indexOf('swiper-slide') === -1) {
447
- child.className += ' swiper-slide';
448
- }
449
- }
450
- _this.slidesCount = _this.nxsSlidesWrapper.nativeElement.children.length;
451
- _this.log('initSlides - html content - slides count => ', _this.slidesCount);
452
- }
453
- });
416
+ (_a = this.eventsCollector) === null || _a === void 0 ? void 0 : _a.unsubscribeAll();
454
417
  };
455
418
  NxsCarouselComponent.prototype.ngOnDestroy = function () {
456
- if (!this.isBrowser) {
457
- return;
458
- }
459
- this.eventsCollector.unsubscribeAll();
460
- if (this.mutationObserver)
461
- this.mutationObserver.disconnect();
462
- if (this.sliderInstance)
463
- this.sliderInstance.destroy();
464
- };
465
- NxsCarouselComponent.prototype.subscribeToSlideChanged = function () {
466
- var _this = this;
467
- if (!this.hasHtmlContent) {
468
- this.log('subscribeToSlideChanged cannot be subscribed : has no html content');
469
- return;
470
- }
471
- if (!this.nxsSlidesWrapper || !this.nxsSlidesWrapper.nativeElement) {
472
- this.log('subscribeToSlideChanged error : nxsSlidesWrapper is not defined');
473
- return;
474
- }
475
- if (typeof MutationObserver === 'undefined') {
476
- this.log('cannot use mutation observer');
477
- return;
478
- }
479
- if (this.mutationObserver)
480
- this.mutationObserver.disconnect();
481
- this.log('subscribe to mutation observer');
482
- this.mutationObserver = new MutationObserver(function (mutationsList) {
483
- var e_1, _b;
484
- // console.log("Log: NxsCarouselComponent -> subscribeToSlideChanged -> mutationsList", mutationsList);
485
- // console.log("Log: NxsCarouselComponent -> subscribeToSlideChanged -> MutationObserver");
486
- _this.log('mutation observer - html content has changed');
487
- if (mutationsList.length === 0)
488
- return;
489
- var mustUpdate = false;
490
- try {
491
- for (var mutationsList_1 = __values(mutationsList), mutationsList_1_1 = mutationsList_1.next(); !mutationsList_1_1.done; mutationsList_1_1 = mutationsList_1.next()) {
492
- var mutation = mutationsList_1_1.value;
493
- if (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0) {
494
- mustUpdate = true;
495
- break;
496
- }
497
- }
498
- }
499
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
500
- finally {
501
- try {
502
- if (mutationsList_1_1 && !mutationsList_1_1.done && (_b = mutationsList_1.return)) _b.call(mutationsList_1);
503
- }
504
- finally { if (e_1) throw e_1.error; }
505
- }
506
- if (mustUpdate) {
507
- _this.initSlides();
508
- _this.createSlider(true);
509
- }
510
- });
511
- this.mutationObserver.observe(this.nxsSlidesWrapper.nativeElement, { childList: true, attributes: false, });
419
+ this.destroy();
512
420
  };
513
421
  NxsCarouselComponent.prototype.ngAfterViewInit = function () {
514
- this.initSlides();
515
- this.createSlider(true);
422
+ // console.log('thi.contents', this.contents);
423
+ // this.initSlides();
424
+ // this.createSlider(true);
516
425
  };
517
426
  NxsCarouselComponent.prototype.getMainSliderHeight = function () {
518
427
  if (!this.options)
@@ -530,10 +439,18 @@
530
439
  NxsCarouselComponent.prototype.setDefaultOptions = function (options, forDialog) {
531
440
  var _a;
532
441
  if (!options && forDialog) {
533
- options = { nxsShowNavigationBullets: true, loop: true, nxsThumbnails: { show: true }, effect: 'slide', nxsShowNavigationArrows: true, nxsShowImagesCount: true };
442
+ options = {
443
+ nxsShowNavigationBullets: true, loop: true, nxsThumbnails: { show: true }, effect: 'slide', nxsShowNavigationArrows: true, nxsShowImagesCount: true,
444
+ lazy: true,
445
+ };
446
+ }
447
+ else if (!options) {
448
+ options = {
449
+ nxsShowNavigationBullets: true, loop: true,
450
+ nxsThumbnails: { show: false }, effect: 'slide', nxsShowNavigationArrows: true, nxsShowImagesCount: false, nxsCarouselDialogOptions: {},
451
+ lazy: true,
452
+ };
534
453
  }
535
- else if (!options)
536
- options = { nxsShowNavigationBullets: true, loop: true, nxsThumbnails: { show: false }, effect: 'slide', nxsShowNavigationArrows: true, nxsShowImagesCount: false, nxsCarouselDialogOptions: {} };
537
454
  if (options.nxsCarouselDialogOptions) {
538
455
  if (typeof options.nxsCarouselDialogOptions.nxsThumbnails === 'undefined')
539
456
  options.nxsCarouselDialogOptions.nxsThumbnails = { show: false };
@@ -569,8 +486,37 @@
569
486
  options.nxsfullscreenOnClick = false;
570
487
  if (options.nxsThumbnails.onMainSlider)
571
488
  options.nxsShowNavigationBullets = false;
489
+ if (typeof options.lazy === 'undefined')
490
+ options.lazy = true;
491
+ if (typeof options.navigation === 'undefined')
492
+ options.navigation = true;
493
+ if (typeof options.pagination === 'undefined')
494
+ options.pagination = { clickable: true };
495
+ // console.log("Log ~ file: nxs-carousel.component.ts ~ line 272 ~ NxsCarouselComponent ~ setDefaultOptions ~ options", options);
572
496
  return options;
573
497
  };
498
+ NxsCarouselComponent.prototype.setThumbnailsOptions = function () {
499
+ var _a, _b;
500
+ if (!!((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.nxsThumbnails) === null || _b === void 0 ? void 0 : _b.show)) {
501
+ this.thumbnailsOptions = {
502
+ slidesPerView: this.options.nxsThumbnails.perView,
503
+ loop: false,
504
+ freeMode: true,
505
+ // watchSlidesVisibility: true,
506
+ watchSlidesProgress: true,
507
+ breakpoints: this.options.nxsThumbnails.breakpoints,
508
+ // spaceBetween: 10,
509
+ };
510
+ if (this.lazy) {
511
+ // Disable preloading of all images
512
+ this.thumbnailsOptions.preloadImages = false;
513
+ // Enable lazy loading
514
+ this.thumbnailsOptions.lazy = true;
515
+ }
516
+ // this.thumbnailsSliderInstance = new Swiper(this.nxsThumbnailsSliderContainer.nativeElement, thumbnailsOptions);
517
+ // this.options.thumbs = { swiper: this.thumbnailsSliderInstance };
518
+ }
519
+ };
574
520
  NxsCarouselComponent.prototype.showFullScreenCarousel = function (images, wrapperClass) {
575
521
  this.options.nxsCarouselDialogOptions = this.setDefaultOptions(this.options.nxsCarouselDialogOptions, true);
576
522
  var data = { images: images, wrapperClass: wrapperClass, options: this.options.nxsCarouselDialogOptions };
@@ -582,113 +528,79 @@
582
528
  disableClose: !this.options.nxsCarouselDialogExitable,
583
529
  });
584
530
  };
585
- NxsCarouselComponent.prototype.createSlider = function (forceRecreate) {
586
- var _this = this;
587
- if (!this.isBrowser) {
588
- this.log('prevent createSlider : platform is server');
589
- return;
590
- }
591
- if (!this.nxsSliderContainer) {
592
- this.log('can not createSlider : nxsSliderContainer is not defined !');
593
- return;
594
- }
595
- this.log('createSlider', this.nxsSliderContainer.nativeElement);
596
- if (this.slidesCount === 0) {
597
- this.log('can not createSlider : slidesCount === 0');
598
- this.subscribeToSlideChanged();
599
- return;
600
- }
601
- if (this.sliderInstance && !forceRecreate) {
602
- this.log('can re create slider => slider is already created.');
603
- return;
604
- }
605
- this.zone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
606
- var _b, Swiper, thumbnailsOptions;
607
- var _this = this;
608
- return __generator(this, function (_c) {
609
- switch (_c.label) {
610
- case 0:
611
- if (this.sliderInstance)
612
- this.sliderInstance.destroy();
613
- this.options.pagination = {
614
- el: '.nxs-carousel-pagination',
615
- clickable: true,
616
- type: 'bullets',
617
- };
618
- this.options.navigation = {
619
- nextEl: '.nxs-carousel-button-next',
620
- prevEl: '.nxs-carousel-button-prev',
621
- };
622
- if (!!this.swiperLibrary) return [3 /*break*/, 2];
623
- _b = this;
624
- return [4 /*yield*/, import('swiper')];
625
- case 1:
626
- _b.swiperLibrary = _c.sent();
627
- _c.label = 2;
628
- case 2:
629
- Swiper = this.swiperLibrary.default;
630
- if (!!this.options.nxsThumbnails && this.options.nxsThumbnails.show) {
631
- thumbnailsOptions = {
632
- slidesPerView: this.options.nxsThumbnails.perView,
633
- loop: false,
634
- freeMode: true,
635
- watchSlidesVisibility: true,
636
- watchSlidesProgress: true,
637
- breakpoints: this.options.nxsThumbnails.breakpoints,
638
- // spaceBetween: 10,
639
- };
640
- this.thumbnailsSliderInstance = new Swiper(this.nxsThumbnailsSliderContainer.nativeElement, thumbnailsOptions);
641
- this.options.thumbs = { swiper: this.thumbnailsSliderInstance };
642
- }
643
- this.sliderInstance = new Swiper(this.nxsSliderContainer.nativeElement, this.options);
644
- this.log('sliderInstance has been created', this.sliderInstance);
645
- this.sliderInstance.on('slideChange', function () {
646
- _this.zone.run(function () {
647
- _this.currentSlide = _this.sliderInstance.realIndex;
648
- _this.log("slideChange", _this.currentSlide);
649
- _this.slideChange.next(_this.currentSlide);
650
- });
651
- });
652
- this.sliderInstance.on('click', function (evt) {
653
- var target = evt.target;
654
- if (target.className.indexOf('nxs-carousel-button') !== -1 || target.className.indexOf('swiper-pagination') !== -1)
655
- return;
656
- _this.zone.run(function () {
657
- _this.slideClick.next(evt);
658
- if (_this.options.nxsfullscreenOnClick && _this.images && _this.images.length && !_this.hasHtmlContent) {
659
- _this.showFullScreenCarousel(_this.images, 'fullscreen-carousel');
660
- }
661
- });
662
- });
663
- this.subscribeToSlideChanged();
664
- return [2 /*return*/];
665
- }
666
- });
667
- }); });
668
- };
669
531
  NxsCarouselComponent.prototype.goToSlide = function (index, speed) {
670
- if (!this.sliderInstance)
671
- return;
672
- this.sliderInstance.slideTo(index, speed);
532
+ var _a;
533
+ (_a = this.swiperInstance) === null || _a === void 0 ? void 0 : _a.slideTo(index, speed);
673
534
  };
674
535
  NxsCarouselComponent.prototype.next = function () {
675
- if (!this.sliderInstance)
676
- return;
677
- this.sliderInstance.slideNext();
536
+ var _a;
537
+ (_a = this.swiperInstance) === null || _a === void 0 ? void 0 : _a.slideNext();
678
538
  };
679
539
  NxsCarouselComponent.prototype.previous = function () {
680
- if (!this.sliderInstance)
681
- return;
682
- this.sliderInstance.slidePrev();
540
+ var _a;
541
+ (_a = this.swiperInstance) === null || _a === void 0 ? void 0 : _a.slidePrev();
542
+ };
543
+ NxsCarouselComponent.prototype.onSwiperThumbnails = function (instance) {
544
+ var _a, _b;
545
+ if ((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.nxsThumbnails) === null || _b === void 0 ? void 0 : _b.show)
546
+ this.thumbnailsSwiperInstance = instance;
547
+ else
548
+ this.thumbnailsSwiperInstance = null;
549
+ // if (this.options?.nxsThumbnails?.show) {
550
+ // const optionsClone = MainHelpers.cloneObject(this.options);
551
+ // optionsClone.thumbs = { swiper: this.thumbnailsSwiperInstance };
552
+ // // this.options = optionsClone;
553
+ // // this.options = { ...this.options, thumbs: { swiper: this.thumbnailsSwiperInstance } };
554
+ // console.log("Log ~ file: nxs-carousel.component.ts ~ line 416 ~ NxsCarouselComponent ~ onSwiperThumbnails ~ this.options ", this.options);
555
+ // this.options.thumbs = { swiper: this.thumbnailsSwiperInstance };
556
+ // }
557
+ };
558
+ NxsCarouselComponent.prototype.onSwiper = function (instance) {
559
+ var _this = this;
560
+ this.log('swiper ready - instance', instance);
561
+ this.swiperInstance = instance;
562
+ this.swiperInstance.on('click', function (swiperInstance, evt) {
563
+ // console.log("Log ~ file: nxs-carousel.component.ts ~ line 392 ~ NxsCarouselComponent ~ this.swiperInstance.on ~ evt", evt);
564
+ var target = evt.target;
565
+ if (target.className.indexOf('nxs-carousel-button') !== -1 || target.className.indexOf('swiper-pagination') !== -1)
566
+ return;
567
+ _this.runInZone(function () {
568
+ _this.slideClick.next(evt);
569
+ if (_this.options.nxsfullscreenOnClick && _this.images && _this.images.length && !_this.hasHtmlContent) {
570
+ _this.showFullScreenCarousel(_this.images, 'fullscreen-carousel');
571
+ }
572
+ });
573
+ });
574
+ };
575
+ NxsCarouselComponent.prototype.runInZone = function (callback) {
576
+ var args = [];
577
+ for (var _i = 1; _i < arguments.length; _i++) {
578
+ args[_i - 1] = arguments[_i];
579
+ }
580
+ if (!this.zone) {
581
+ callback(args);
582
+ }
583
+ return this.zone.run(function () { return callback(args); });
584
+ };
585
+ NxsCarouselComponent.prototype.onSlideChange = function (instances) {
586
+ var _this = this;
587
+ // this.swiperInstance = instance;
588
+ // this.log('slide change - instance', instance);
589
+ this.runInZone(function () {
590
+ var _a;
591
+ _this.currentSlide = ((_a = _this.swiperInstance) === null || _a === void 0 ? void 0 : _a.realIndex) || 0;
592
+ _this.log('slide change - currentSlide', _this.currentSlide);
593
+ _this.slideChange.next(_this.currentSlide);
594
+ });
683
595
  };
684
596
  return NxsCarouselComponent;
685
597
  }());
686
598
  NxsCarouselComponent.decorators = [
687
599
  { type: core.Component, args: [{
688
600
  selector: 'nxs-carousel',
689
- template: "<div #nxsSliderContainer\n \u00A0[ngClass]=\"{'swiper-container':true,'nxs-slider-with-thumbnails':!!options.nxsThumbnails && options.nxsThumbnails.show}\"\n [style.height]=\"getMainSliderHeight()\">\n <div class=\"swiper-wrapper\" #nxsSlidesWrapper>\n <ng-content>\n\n </ng-content>\n </div>\n <!-- (cdkObserveContent)=\"onContentChange($event)\" -->\n <!-- If we need pagination -->\n <div class=\"swiper-pagination nxs-carousel-pagination\"\n [style.display]=\"slidesCount>0 && options && options.nxsShowNavigationBullets ? '':'none'\"></div>\n\n <!-- If we need navigation buttons -->\n <ng-container *ngIf=\"options.nxsShowNavigationArrows\">\n <div class=\"nxs-carousel-button-prev swiper-button-prev\"></div>\n <div class=\"nxs-carousel-button-next swiper-button-next\"></div>\n </ng-container>\n\n <ng-container *ngIf=\"images && options.nxsShowImagesCount\">\n <div class=\"nxs-image-counter\">\n {{currentSlide+1}} / {{images.length}}\n </div>\n </ng-container>\n\n</div>\n\n<div #nxsThumbnailsSliderContainer\n [style.display]=\"(images && !!options.nxsThumbnails && options.nxsThumbnails.show) ?'':'none'\"\n [style.height]=\"(!!options.nxsThumbnails && options.nxsThumbnails.show && !!options.nxsThumbnails.percentHeight) ? (options.nxsThumbnails.percentHeight + '%'):''\"\n [style.top]=\"(!!options.nxsThumbnails && options.nxsThumbnails.show && !!options.nxsThumbnails.percentHeight && options.nxsThumbnails.onMainSlider) ? ('-' + (options.nxsThumbnails.percentHeight) + '%'):''\"\n [ngClass]=\"{'swiper-container':true, 'nxs-slider-thumbnails-container':true,'nxs-slider-thumbnails-on-main-slider':options.nxsThumbnails && options.nxsThumbnails.onMainSlider}\">\n <div class=\"swiper-wrapper\" #nxsThumbnailsSlidesWrapper>\n\n </div>\n\n</div>",
601
+ template: "<div *ngIf=\"options\"\n [ngClass]=\"{'swiper-container':true,'nxs-slider-with-thumbnails':!!options.nxsThumbnails && options.nxsThumbnails.show}\"\n [style.height]=\"getMainSliderHeight()\">\n <swiper [config]=\"options\" (swiper)=\"onSwiper($event)\" (slideChange)=\"onSlideChange($event)\"\n [thumbs]=\"{ swiper: thumbnailsSwiperInstance }\">\n <ng-container *ngIf=\"hasHtmlContent\">\n <ng-template *ngFor=\"let slide of contents\" swiperSlide>\n <ng-template [ngTemplateOutlet]=\"slide\" [ngTemplateOutletContext]=\"{\n $implicit: slide\n }\"></ng-template>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"!hasHtmlContent && images?.length\">\n <ng-template swiperSlide *ngFor=\"let slideImage of images\">\n <img class=\"nxs-image-slide swiper-lazy\" [attr.data-src]=\"slideImage.src\" />\n <div class=\"swiper-lazy-preloader swiper-lazy-preloader-black\"></div>\n </ng-template>\n </ng-container>\n </swiper>\n <ng-container *ngIf=\"images && options.nxsShowImagesCount\">\n <div class=\"nxs-image-counter\">\n {{currentSlide+1}} / {{images.length}}\n </div>\n </ng-container>\n</div>\n\n<div *ngIf=\"thumbnailsOptions && images?.length\"\n [style.height]=\"(!!options.nxsThumbnails && options.nxsThumbnails.show && !!options.nxsThumbnails.percentHeight) ? (options.nxsThumbnails.percentHeight + '%'):''\"\n [style.top]=\"(!!options.nxsThumbnails && options.nxsThumbnails.show && !!options.nxsThumbnails.percentHeight && options.nxsThumbnails.onMainSlider) ? ('-' + (options.nxsThumbnails.percentHeight) + '%'):''\"\n [ngClass]=\"{'swiper-container':true, 'nxs-slider-thumbnails-container':true,'nxs-slider-thumbnails-on-main-slider':options.nxsThumbnails && options.nxsThumbnails.onMainSlider}\">\n <swiper [config]=\"thumbnailsOptions\" (swiper)=\"onSwiperThumbnails($event)\">\n <ng-template swiperSlide *ngFor=\"let slideImage of images\">\n <img class=\"nxs-image-slide swiper-lazy\" [attr.data-src]=\"slideImage.src\" />\n <div class=\"swiper-lazy-preloader swiper-lazy-preloader-black\"></div>\n </ng-template>\n </swiper>\n</div>",
690
602
  encapsulation: core.ViewEncapsulation.None,
691
- styles: ["nxs-carousel{display:block;height:100%;position:relative;--swiper-navigation-color:#fff;--swiper-theme-color:#fff}nxs-carousel .swiper-container{width:100%;display:block;position:relative;height:100%}nxs-carousel .swiper-container .swiper-wrapper .swiper-slide{height:100%;position:relative;width:100%;min-height:50px;background-size:cover;background-position:50%;background-repeat:no-repeat}nxs-carousel .swiper-container.nxs-slider-with-thumbnails{height:80%}nxs-carousel .swiper-container.nxs-slider-thumbnails-container{height:20%;background:transparent;padding:6px 0}nxs-carousel .swiper-container.nxs-slider-thumbnails-container .swiper-slide{cursor:pointer;border-radius:6px;margin:0 6px;border:2px solid transparent}nxs-carousel .swiper-container.nxs-slider-thumbnails-container .swiper-slide.swiper-slide-thumb-active{border:2px solid #add8e6}nxs-carousel .swiper-container.nxs-slider-thumbnails-on-main-slider{top:-20%}nxs-carousel .nxs-image-counter{position:absolute;top:0;right:0;color:#fff;padding:4px;font-weight:700;z-index:10}"]
603
+ styles: ["@import \"~swiper/swiper.min.css\";@import \"~swiper/modules/navigation/navigation.min.css\";@import \"~swiper/modules/pagination/pagination.min.css\";@import \"~swiper/modules/lazy/lazy.min.css\";nxs-carousel{display:block;height:100%;position:relative;--swiper-navigation-color:#fff;--swiper-pagination-color:#fff;--swiper-theme-color:#fff}nxs-carousel .swiper-container{width:100%;height:100%;display:block;position:relative}nxs-carousel .swiper-container swiper{height:100%}nxs-carousel .swiper-container .swiper-wrapper .swiper-slide{height:100%;position:relative;width:100%;min-height:50px;background-size:cover;background-position:50%;background-repeat:no-repeat}nxs-carousel .swiper-container .nxs-image-slide{height:100%;-o-object-fit:cover;object-fit:cover;width:100%;-o-object-position:center;object-position:center}nxs-carousel .swiper-container.nxs-slider-with-thumbnails{height:80%}nxs-carousel .swiper-container.nxs-slider-thumbnails-container{height:20%;background:transparent;padding:6px 0}nxs-carousel .swiper-container.nxs-slider-thumbnails-container .swiper-slide{cursor:pointer;border-radius:6px;margin:0 6px;border:2px solid transparent}nxs-carousel .swiper-container.nxs-slider-thumbnails-container .swiper-slide.swiper-slide-thumb-active{border:2px solid #add8e6}nxs-carousel .swiper-container.nxs-slider-thumbnails-on-main-slider{top:-20%}nxs-carousel .nxs-image-counter{position:absolute;top:0;right:0;color:#fff;padding:4px;font-weight:700;z-index:10}"]
692
604
  },] }
693
605
  ];
694
606
  NxsCarouselComponent.ctorParameters = function () { return [
@@ -698,12 +610,11 @@
698
610
  { type: NxsCarouselModuleConfig, decorators: [{ type: core.Optional }] }
699
611
  ]; };
700
612
  NxsCarouselComponent.propDecorators = {
701
- nxsSliderContainer: [{ type: core.ViewChild, args: ['nxsSliderContainer', { static: true },] }],
702
- nxsSlidesWrapper: [{ type: core.ViewChild, args: ['nxsSlidesWrapper', { static: true },] }],
703
- nxsThumbnailsSliderContainer: [{ type: core.ViewChild, args: ['nxsThumbnailsSliderContainer', { static: true },] }],
704
- nxsThumbnailsSlidesWrapper: [{ type: core.ViewChild, args: ['nxsThumbnailsSlidesWrapper', { static: true },] }],
613
+ contents: [{ type: core.ContentChildren, args: [NxsSwiperTemplateDirective, { read: core.TemplateRef },] }],
614
+ swiperComponent: [{ type: core.ViewChild, args: ['swiper', { static: false },] }],
615
+ lazy: [{ type: core.Input }],
616
+ images: [{ type: core.Input }],
705
617
  setOptions: [{ type: core.Input, args: ['options',] }],
706
- setImages: [{ type: core.Input, args: ['images',] }],
707
618
  hasHtmlContent: [{ type: core.Input }],
708
619
  slideChange: [{ type: core.Output }],
709
620
  slideClick: [{ type: core.Output }]
@@ -727,16 +638,18 @@
727
638
  declarations: [
728
639
  NxsCarouselComponent,
729
640
  NxsCarouselDialogComponent,
641
+ NxsSwiperTemplateDirective,
730
642
  ],
731
643
  imports: [
732
644
  common.CommonModule,
733
645
  icon.MatIconModule,
734
646
  button.MatButtonModule,
735
647
  dialog.MatDialogModule,
736
- observers.ObserversModule,
648
+ angular.SwiperModule,
737
649
  ],
738
650
  exports: [
739
651
  NxsCarouselComponent,
652
+ NxsSwiperTemplateDirective,
740
653
  ],
741
654
  },] }
742
655
  ];
@@ -748,7 +661,8 @@
748
661
  exports.NxsCarouselComponent = NxsCarouselComponent;
749
662
  exports.NxsCarouselModule = NxsCarouselModule;
750
663
  exports.NxsCarouselModuleConfig = NxsCarouselModuleConfig;
751
- exports.ɵa = NxsCarouselDialogComponent;
664
+ exports.ɵa = NxsSwiperTemplateDirective;
665
+ exports.ɵb = NxsCarouselDialogComponent;
752
666
 
753
667
  Object.defineProperty(exports, '__esModule', { value: true });
754
668