nextalys-carousel 0.0.53 → 0.0.56

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.
@@ -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,144 +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;
408
- 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
- return;
415
- }
416
- this.log('initSlides begins');
417
- this.zone.runOutsideAngular(function () {
418
- var e_1, _d, e_2, _e;
419
- if (!_this.hasHtmlContent && _this.images) {
420
- _this.nxsSlidesWrapper.nativeElement.innerHTML = '';
421
- try {
422
- for (var _f = __values(_this.images), _g = _f.next(); !_g.done; _g = _f.next()) {
423
- var cImage = _g.value;
424
- var div = document.createElement('div');
425
- div.className = 'swiper-slide';
426
- div.style.backgroundImage = 'url(' + cImage.src + ')';
427
- if (_this.options.nxsCarouselImageBackgroundSize)
428
- div.style.backgroundSize = _this.options.nxsCarouselImageBackgroundSize;
429
- _this.nxsSlidesWrapper.nativeElement.appendChild(div);
430
- }
431
- }
432
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
433
- finally {
434
- try {
435
- if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
436
- }
437
- finally { if (e_1) throw e_1.error; }
438
- }
439
- _this.slidesCount = _this.images.length;
440
- if (!!_this.options.nxsThumbnails && _this.options.nxsThumbnails.show) {
441
- _this.nxsThumbnailsSlidesWrapper.nativeElement.innerHTML = '';
442
- try {
443
- for (var _h = __values(_this.images), _j = _h.next(); !_j.done; _j = _h.next()) {
444
- var cImage = _j.value;
445
- var div = document.createElement('div');
446
- div.className = 'swiper-slide';
447
- div.style.backgroundImage = 'url(' + cImage.src + ')';
448
- _this.nxsThumbnailsSlidesWrapper.nativeElement.appendChild(div);
449
- }
450
- }
451
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
452
- finally {
453
- try {
454
- if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
455
- }
456
- finally { if (e_2) throw e_2.error; }
457
- }
458
- }
459
- _this.log('initSlides - images are defined - slides count => ', _this.slidesCount);
460
- }
461
- else if (_this.hasHtmlContent) {
462
- _this.log('initSlides - html content - slides length => ', _this.nxsSlidesWrapper.nativeElement.children.length);
463
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
464
- for (var i = 0; i < _this.nxsSlidesWrapper.nativeElement.children.length; i++) {
465
- var child = _this.nxsSlidesWrapper.nativeElement.children[i];
466
- if (!child.className)
467
- child.className = 'swiper-slide';
468
- else if (child.className.indexOf('swiper-slide') === -1) {
469
- child.className += ' swiper-slide';
470
- }
471
- }
472
- _this.slidesCount = _this.nxsSlidesWrapper.nativeElement.children.length;
473
- _this.log('initSlides - html content - slides count => ', _this.slidesCount);
474
- }
475
- });
476
- };
477
411
  NxsCarouselComponent.prototype.destroy = function () {
478
- var _a, _b, _c;
412
+ var _a;
479
413
  if (!this.isBrowser) {
480
414
  return;
481
415
  }
482
416
  (_a = this.eventsCollector) === null || _a === void 0 ? void 0 : _a.unsubscribeAll();
483
- (_b = this.mutationObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
484
- (_c = this.sliderInstance) === null || _c === void 0 ? void 0 : _c.destroy();
485
417
  };
486
418
  NxsCarouselComponent.prototype.ngOnDestroy = function () {
487
419
  this.destroy();
488
420
  };
489
- NxsCarouselComponent.prototype.subscribeToSlideChanged = function () {
490
- var _this = this;
491
- if (!this.hasHtmlContent) {
492
- this.log('subscribeToSlideChanged cannot be subscribed : has no html content');
493
- return;
494
- }
495
- if (!this.nxsSlidesWrapper || !this.nxsSlidesWrapper.nativeElement) {
496
- this.log('subscribeToSlideChanged error : nxsSlidesWrapper is not defined');
497
- return;
498
- }
499
- if (typeof MutationObserver === 'undefined') {
500
- this.log('cannot use mutation observer');
501
- return;
502
- }
503
- if (this.mutationObserver)
504
- this.mutationObserver.disconnect();
505
- this.log('subscribe to mutation observer');
506
- this.mutationObserver = new MutationObserver(function (mutationsList) {
507
- var e_3, _d;
508
- // console.log("Log: NxsCarouselComponent -> subscribeToSlideChanged -> mutationsList", mutationsList);
509
- // console.log("Log: NxsCarouselComponent -> subscribeToSlideChanged -> MutationObserver");
510
- _this.log('mutation observer - html content has changed');
511
- if (mutationsList.length === 0)
512
- return;
513
- var mustUpdate = false;
514
- try {
515
- for (var mutationsList_1 = __values(mutationsList), mutationsList_1_1 = mutationsList_1.next(); !mutationsList_1_1.done; mutationsList_1_1 = mutationsList_1.next()) {
516
- var mutation = mutationsList_1_1.value;
517
- if (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0) {
518
- mustUpdate = true;
519
- break;
520
- }
521
- }
522
- }
523
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
524
- finally {
525
- try {
526
- if (mutationsList_1_1 && !mutationsList_1_1.done && (_d = mutationsList_1.return)) _d.call(mutationsList_1);
527
- }
528
- finally { if (e_3) throw e_3.error; }
529
- }
530
- if (mustUpdate) {
531
- _this.initSlides();
532
- _this.createSlider(true);
533
- }
534
- });
535
- this.mutationObserver.observe(this.nxsSlidesWrapper.nativeElement, { childList: true, attributes: false, });
536
- };
537
421
  NxsCarouselComponent.prototype.ngAfterViewInit = function () {
538
- this.initSlides();
539
- this.createSlider(true);
422
+ // console.log('thi.contents', this.contents);
423
+ // this.initSlides();
424
+ // this.createSlider(true);
540
425
  };
541
426
  NxsCarouselComponent.prototype.getMainSliderHeight = function () {
542
427
  if (!this.options)
@@ -554,10 +439,18 @@
554
439
  NxsCarouselComponent.prototype.setDefaultOptions = function (options, forDialog) {
555
440
  var _a;
556
441
  if (!options && forDialog) {
557
- 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
+ };
558
453
  }
559
- else if (!options)
560
- options = { nxsShowNavigationBullets: true, loop: true, nxsThumbnails: { show: false }, effect: 'slide', nxsShowNavigationArrows: true, nxsShowImagesCount: false, nxsCarouselDialogOptions: {} };
561
454
  if (options.nxsCarouselDialogOptions) {
562
455
  if (typeof options.nxsCarouselDialogOptions.nxsThumbnails === 'undefined')
563
456
  options.nxsCarouselDialogOptions.nxsThumbnails = { show: false };
@@ -593,8 +486,37 @@
593
486
  options.nxsfullscreenOnClick = false;
594
487
  if (options.nxsThumbnails.onMainSlider)
595
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);
596
496
  return options;
597
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
+ };
598
520
  NxsCarouselComponent.prototype.showFullScreenCarousel = function (images, wrapperClass) {
599
521
  this.options.nxsCarouselDialogOptions = this.setDefaultOptions(this.options.nxsCarouselDialogOptions, true);
600
522
  var data = { images: images, wrapperClass: wrapperClass, options: this.options.nxsCarouselDialogOptions };
@@ -606,112 +528,79 @@
606
528
  disableClose: !this.options.nxsCarouselDialogExitable,
607
529
  });
608
530
  };
609
- NxsCarouselComponent.prototype.createSlider = function (forceRecreate) {
610
- var _this = this;
611
- if (!this.isBrowser) {
612
- this.log('prevent createSlider : platform is server');
613
- return;
614
- }
615
- if (!this.nxsSliderContainer) {
616
- this.log('can not createSlider : nxsSliderContainer is not defined !');
617
- return;
618
- }
619
- this.log('createSlider', this.nxsSliderContainer.nativeElement);
620
- if (this.slidesCount === 0) {
621
- this.log('can not createSlider : slidesCount === 0');
622
- this.subscribeToSlideChanged();
623
- return;
624
- }
625
- if (this.sliderInstance && !forceRecreate) {
626
- this.log('can re create slider => slider is already created.');
627
- return;
628
- }
629
- this.zone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
630
- var _d, Swiper, thumbnailsOptions;
631
- var _this = this;
632
- return __generator(this, function (_e) {
633
- switch (_e.label) {
634
- case 0:
635
- this.destroy();
636
- this.options.pagination = {
637
- el: '.nxs-carousel-pagination',
638
- clickable: true,
639
- type: 'bullets',
640
- };
641
- this.options.navigation = {
642
- nextEl: '.nxs-carousel-button-next',
643
- prevEl: '.nxs-carousel-button-prev',
644
- };
645
- if (!!this.swiperLibrary) return [3 /*break*/, 2];
646
- _d = this;
647
- return [4 /*yield*/, import('swiper')];
648
- case 1:
649
- _d.swiperLibrary = _e.sent();
650
- _e.label = 2;
651
- case 2:
652
- Swiper = this.swiperLibrary.default;
653
- if (!!this.options.nxsThumbnails && this.options.nxsThumbnails.show) {
654
- thumbnailsOptions = {
655
- slidesPerView: this.options.nxsThumbnails.perView,
656
- loop: false,
657
- freeMode: true,
658
- watchSlidesVisibility: true,
659
- watchSlidesProgress: true,
660
- breakpoints: this.options.nxsThumbnails.breakpoints,
661
- // spaceBetween: 10,
662
- };
663
- this.thumbnailsSliderInstance = new Swiper(this.nxsThumbnailsSliderContainer.nativeElement, thumbnailsOptions);
664
- this.options.thumbs = { swiper: this.thumbnailsSliderInstance };
665
- }
666
- this.sliderInstance = new Swiper(this.nxsSliderContainer.nativeElement, this.options);
667
- this.log('sliderInstance has been created', this.sliderInstance);
668
- this.sliderInstance.on('slideChange', function () {
669
- _this.zone.run(function () {
670
- _this.currentSlide = _this.sliderInstance.realIndex;
671
- _this.log("slideChange", _this.currentSlide);
672
- _this.slideChange.next(_this.currentSlide);
673
- });
674
- });
675
- this.sliderInstance.on('click', function (evt) {
676
- var target = evt.target;
677
- if (target.className.indexOf('nxs-carousel-button') !== -1 || target.className.indexOf('swiper-pagination') !== -1)
678
- return;
679
- _this.zone.run(function () {
680
- _this.slideClick.next(evt);
681
- if (_this.options.nxsfullscreenOnClick && _this.images && _this.images.length && !_this.hasHtmlContent) {
682
- _this.showFullScreenCarousel(_this.images, 'fullscreen-carousel');
683
- }
684
- });
685
- });
686
- this.subscribeToSlideChanged();
687
- return [2 /*return*/];
688
- }
689
- });
690
- }); });
691
- };
692
531
  NxsCarouselComponent.prototype.goToSlide = function (index, speed) {
693
- if (!this.sliderInstance)
694
- return;
695
- this.sliderInstance.slideTo(index, speed);
532
+ var _a;
533
+ (_a = this.swiperInstance) === null || _a === void 0 ? void 0 : _a.slideTo(index, speed);
696
534
  };
697
535
  NxsCarouselComponent.prototype.next = function () {
698
- if (!this.sliderInstance)
699
- return;
700
- this.sliderInstance.slideNext();
536
+ var _a;
537
+ (_a = this.swiperInstance) === null || _a === void 0 ? void 0 : _a.slideNext();
701
538
  };
702
539
  NxsCarouselComponent.prototype.previous = function () {
703
- if (!this.sliderInstance)
704
- return;
705
- 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
+ });
706
595
  };
707
596
  return NxsCarouselComponent;
708
597
  }());
709
598
  NxsCarouselComponent.decorators = [
710
599
  { type: core.Component, args: [{
711
600
  selector: 'nxs-carousel',
712
- 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>",
713
602
  encapsulation: core.ViewEncapsulation.None,
714
- 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: ["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}"]
715
604
  },] }
716
605
  ];
717
606
  NxsCarouselComponent.ctorParameters = function () { return [
@@ -721,12 +610,11 @@
721
610
  { type: NxsCarouselModuleConfig, decorators: [{ type: core.Optional }] }
722
611
  ]; };
723
612
  NxsCarouselComponent.propDecorators = {
724
- nxsSliderContainer: [{ type: core.ViewChild, args: ['nxsSliderContainer', { static: true },] }],
725
- nxsSlidesWrapper: [{ type: core.ViewChild, args: ['nxsSlidesWrapper', { static: true },] }],
726
- nxsThumbnailsSliderContainer: [{ type: core.ViewChild, args: ['nxsThumbnailsSliderContainer', { static: true },] }],
727
- 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 }],
728
617
  setOptions: [{ type: core.Input, args: ['options',] }],
729
- setImages: [{ type: core.Input, args: ['images',] }],
730
618
  hasHtmlContent: [{ type: core.Input }],
731
619
  slideChange: [{ type: core.Output }],
732
620
  slideClick: [{ type: core.Output }]
@@ -750,16 +638,18 @@
750
638
  declarations: [
751
639
  NxsCarouselComponent,
752
640
  NxsCarouselDialogComponent,
641
+ NxsSwiperTemplateDirective,
753
642
  ],
754
643
  imports: [
755
644
  common.CommonModule,
756
645
  icon.MatIconModule,
757
646
  button.MatButtonModule,
758
647
  dialog.MatDialogModule,
759
- observers.ObserversModule,
648
+ angular.SwiperModule,
760
649
  ],
761
650
  exports: [
762
651
  NxsCarouselComponent,
652
+ NxsSwiperTemplateDirective,
763
653
  ],
764
654
  },] }
765
655
  ];
@@ -771,7 +661,8 @@
771
661
  exports.NxsCarouselComponent = NxsCarouselComponent;
772
662
  exports.NxsCarouselModule = NxsCarouselModule;
773
663
  exports.NxsCarouselModuleConfig = NxsCarouselModuleConfig;
774
- exports.ɵa = NxsCarouselDialogComponent;
664
+ exports.ɵa = NxsSwiperTemplateDirective;
665
+ exports.ɵb = NxsCarouselDialogComponent;
775
666
 
776
667
  Object.defineProperty(exports, '__esModule', { value: true });
777
668