@fundamental-ngx/core 0.34.3-rc.10 → 0.34.3-rc.13

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.
Files changed (135) hide show
  1. package/action-bar/package.json +1 -1
  2. package/action-sheet/package.json +1 -1
  3. package/alert/package.json +1 -1
  4. package/avatar/package.json +1 -1
  5. package/avatar-group/package.json +1 -1
  6. package/bar/package.json +1 -1
  7. package/breadcrumb/package.json +1 -1
  8. package/busy-indicator/package.json +1 -1
  9. package/button/package.json +1 -1
  10. package/calendar/package.json +1 -1
  11. package/card/package.json +1 -1
  12. package/carousel/carousel.component.d.ts +20 -3
  13. package/carousel/esm2020/carousel.component.mjs +90 -26
  14. package/carousel/fesm2015/fundamental-ngx-core-carousel.mjs +89 -25
  15. package/carousel/fesm2015/fundamental-ngx-core-carousel.mjs.map +1 -1
  16. package/carousel/fesm2020/fundamental-ngx-core-carousel.mjs +89 -25
  17. package/carousel/fesm2020/fundamental-ngx-core-carousel.mjs.map +1 -1
  18. package/carousel/package.json +1 -1
  19. package/checkbox/package.json +1 -1
  20. package/combobox/package.json +1 -1
  21. package/date-picker/package.json +1 -1
  22. package/datetime/package.json +1 -1
  23. package/datetime-picker/package.json +1 -1
  24. package/dialog/package.json +1 -1
  25. package/dynamic-page/dynamic-page-content/dynamic-page-content.component.d.ts +8 -5
  26. package/dynamic-page/dynamic-page.component.d.ts +6 -9
  27. package/dynamic-page/esm2020/dynamic-page-content/dynamic-page-content.component.mjs +15 -14
  28. package/dynamic-page/esm2020/dynamic-page.component.mjs +26 -22
  29. package/dynamic-page/fesm2015/fundamental-ngx-core-dynamic-page.mjs +40 -35
  30. package/dynamic-page/fesm2015/fundamental-ngx-core-dynamic-page.mjs.map +1 -1
  31. package/dynamic-page/fesm2020/fundamental-ngx-core-dynamic-page.mjs +39 -33
  32. package/dynamic-page/fesm2020/fundamental-ngx-core-dynamic-page.mjs.map +1 -1
  33. package/dynamic-page/package.json +1 -1
  34. package/dynamic-side-content/package.json +1 -1
  35. package/esm2020/carousel/carousel.component.mjs +90 -26
  36. package/esm2020/dynamic-page/dynamic-page-content/dynamic-page-content.component.mjs +15 -14
  37. package/esm2020/dynamic-page/dynamic-page.component.mjs +26 -22
  38. package/esm2020/grid-list/helpers/parse-layout-pattern.mjs +2 -2
  39. package/esm2020/menu/services/menu.service.mjs +8 -6
  40. package/facets/package.json +1 -1
  41. package/feed-input/package.json +1 -1
  42. package/feed-list-item/package.json +1 -1
  43. package/fesm2015/fundamental-ngx-core-carousel.mjs +89 -25
  44. package/fesm2015/fundamental-ngx-core-carousel.mjs.map +1 -1
  45. package/fesm2015/fundamental-ngx-core-dynamic-page.mjs +40 -35
  46. package/fesm2015/fundamental-ngx-core-dynamic-page.mjs.map +1 -1
  47. package/fesm2015/fundamental-ngx-core-grid-list.mjs +1 -1
  48. package/fesm2015/fundamental-ngx-core-grid-list.mjs.map +1 -1
  49. package/fesm2015/fundamental-ngx-core-menu.mjs +7 -5
  50. package/fesm2015/fundamental-ngx-core-menu.mjs.map +1 -1
  51. package/fesm2020/fundamental-ngx-core-carousel.mjs +89 -25
  52. package/fesm2020/fundamental-ngx-core-carousel.mjs.map +1 -1
  53. package/fesm2020/fundamental-ngx-core-dynamic-page.mjs +39 -33
  54. package/fesm2020/fundamental-ngx-core-dynamic-page.mjs.map +1 -1
  55. package/fesm2020/fundamental-ngx-core-grid-list.mjs +1 -1
  56. package/fesm2020/fundamental-ngx-core-grid-list.mjs.map +1 -1
  57. package/fesm2020/fundamental-ngx-core-menu.mjs +7 -5
  58. package/fesm2020/fundamental-ngx-core-menu.mjs.map +1 -1
  59. package/file-uploader/package.json +1 -1
  60. package/fixed-card-layout/package.json +1 -1
  61. package/flexible-column-layout/package.json +1 -1
  62. package/form/package.json +1 -1
  63. package/formatted-text/package.json +1 -1
  64. package/grid-list/esm2020/helpers/parse-layout-pattern.mjs +2 -2
  65. package/grid-list/fesm2015/fundamental-ngx-core-grid-list.mjs +1 -1
  66. package/grid-list/fesm2015/fundamental-ngx-core-grid-list.mjs.map +1 -1
  67. package/grid-list/fesm2020/fundamental-ngx-core-grid-list.mjs +1 -1
  68. package/grid-list/fesm2020/fundamental-ngx-core-grid-list.mjs.map +1 -1
  69. package/grid-list/package.json +1 -1
  70. package/icon/package.json +1 -1
  71. package/illustrated-message/package.json +1 -1
  72. package/infinite-scroll/package.json +1 -1
  73. package/info-label/package.json +1 -1
  74. package/inline-help/package.json +1 -1
  75. package/input-group/package.json +1 -1
  76. package/layout-grid/package.json +1 -1
  77. package/layout-panel/package.json +1 -1
  78. package/link/package.json +1 -1
  79. package/list/package.json +1 -1
  80. package/menu/esm2020/services/menu.service.mjs +8 -6
  81. package/menu/fesm2015/fundamental-ngx-core-menu.mjs +7 -5
  82. package/menu/fesm2015/fundamental-ngx-core-menu.mjs.map +1 -1
  83. package/menu/fesm2020/fundamental-ngx-core-menu.mjs +7 -5
  84. package/menu/fesm2020/fundamental-ngx-core-menu.mjs.map +1 -1
  85. package/menu/package.json +1 -1
  86. package/message-box/package.json +1 -1
  87. package/message-strip/package.json +1 -1
  88. package/message-toast/package.json +1 -1
  89. package/micro-process-flow/package.json +1 -1
  90. package/mobile-mode/package.json +1 -1
  91. package/multi-input/package.json +1 -1
  92. package/nested-list/package.json +1 -1
  93. package/notification/package.json +1 -1
  94. package/object-identifier/package.json +1 -1
  95. package/object-marker/package.json +1 -1
  96. package/object-number/package.json +1 -1
  97. package/object-status/package.json +1 -1
  98. package/package.json +1 -1
  99. package/pagination/package.json +1 -1
  100. package/panel/package.json +1 -1
  101. package/popover/package.json +1 -1
  102. package/product-switch/package.json +1 -1
  103. package/progress-indicator/package.json +1 -1
  104. package/quick-view/package.json +1 -1
  105. package/radio/package.json +1 -1
  106. package/rating-indicator/package.json +1 -1
  107. package/resizable-card-layout/package.json +1 -1
  108. package/scroll-spy/package.json +1 -1
  109. package/scrollbar/package.json +1 -1
  110. package/segmented-button/package.json +1 -1
  111. package/select/package.json +1 -1
  112. package/shared/package.json +1 -1
  113. package/shellbar/package.json +1 -1
  114. package/side-navigation/package.json +1 -1
  115. package/slider/package.json +1 -1
  116. package/split-button/package.json +1 -1
  117. package/splitter/package.json +1 -1
  118. package/status-indicator/package.json +1 -1
  119. package/step-input/package.json +1 -1
  120. package/switch/package.json +1 -1
  121. package/table/package.json +1 -1
  122. package/tabs/package.json +1 -1
  123. package/text/package.json +1 -1
  124. package/tile/package.json +1 -1
  125. package/time/package.json +1 -1
  126. package/time-picker/package.json +1 -1
  127. package/timeline/package.json +1 -1
  128. package/title/package.json +1 -1
  129. package/token/package.json +1 -1
  130. package/toolbar/package.json +1 -1
  131. package/tree/package.json +1 -1
  132. package/upload-collection/package.json +1 -1
  133. package/utils/package.json +1 -1
  134. package/vertical-navigation/package.json +1 -1
  135. package/wizard/package.json +1 -1
@@ -547,7 +547,7 @@ class CarouselComponent {
547
547
  this._changeDetectorRef = _changeDetectorRef;
548
548
  this._carouselService = _carouselService;
549
549
  this._rtlService = _rtlService;
550
- /** Id for the Carousel. */
550
+ /** ID for the Carousel. */
551
551
  this.id = `fd-carousel-${carouselCounter++}`;
552
552
  /** Sets aria-label attribute for carousel */
553
553
  this.ariaLabel = null;
@@ -577,8 +577,6 @@ class CarouselComponent {
577
577
  this.swipeEnabled = true;
578
578
  /** Is carousel is vertical. Default value is false. */
579
579
  this.vertical = false;
580
- /** Number of items to be visible at a time */
581
- this.visibleSlidesCount = 1;
582
580
  /** An event that is emitted after a slide transition has happened */
583
581
  this.slideChange = new EventEmitter();
584
582
  /**
@@ -602,6 +600,10 @@ class CarouselComponent {
602
600
  /** @hidden */
603
601
  this._slidesWrapperSize = 0;
604
602
  /** @hidden */
603
+ this._visibleSlidesCount = 1;
604
+ /** @hidden */
605
+ this._visibleSlidesNumericCount = 1;
606
+ /** @hidden */
605
607
  this._resourceStrings = CarouselResourceStringsEN;
606
608
  /** @hidden */
607
609
  this._config = {};
@@ -625,6 +627,14 @@ class CarouselComponent {
625
627
  get resourceStrings() {
626
628
  return this._resourceStrings;
627
629
  }
630
+ /** Number of items to be visible at a time */
631
+ set visibleSlidesCount(value) {
632
+ this._visibleSlidesCount = value;
633
+ this._visibleSlidesNumericCount = this._getVisibleSlidesCount();
634
+ }
635
+ get visibleSlidesCount() {
636
+ return this._visibleSlidesCount;
637
+ }
628
638
  /**
629
639
  * @hidden Returns the `tabIndex` of the carousel component.
630
640
  */
@@ -669,16 +679,16 @@ class CarouselComponent {
669
679
  ngAfterViewInit() {
670
680
  this._initializeServiceConfig();
671
681
  this._carouselService.initialise(this._config, this.slides, this.slideContainer);
672
- this._previousVisibleSlidesCount = this.visibleSlidesCount;
682
+ this._previousVisibleSlidesCount = this._visibleSlidesNumericCount;
673
683
  this._resizeContentContainer();
674
684
  }
675
685
  /** @hidden */
676
686
  ngAfterViewChecked() {
677
- if (this._previousVisibleSlidesCount && this._previousVisibleSlidesCount !== this.visibleSlidesCount) {
687
+ if (this._previousVisibleSlidesCount && this._previousVisibleSlidesCount !== this._visibleSlidesNumericCount) {
678
688
  this._initializeCarousel();
679
689
  this._initializeServiceConfig();
680
690
  this._carouselService.updateConfig(this._config);
681
- this._previousVisibleSlidesCount = this.visibleSlidesCount;
691
+ this._previousVisibleSlidesCount = this._visibleSlidesNumericCount;
682
692
  this._changeDetectorRef.detectChanges();
683
693
  }
684
694
  }
@@ -802,8 +812,8 @@ class CarouselComponent {
802
812
  this.rightButtonDisabled = true;
803
813
  this.leftButtonDisabled = false;
804
814
  }
805
- else if (this.visibleSlidesCount > 1 &&
806
- this.currentActiveSlidesStartIndex + this.visibleSlidesCount >= this.slides.length) {
815
+ else if (this._visibleSlidesNumericCount > 1 &&
816
+ this.currentActiveSlidesStartIndex + this._visibleSlidesNumericCount >= this.slides.length) {
807
817
  this.rightButtonDisabled = true;
808
818
  }
809
819
  else {
@@ -837,19 +847,19 @@ class CarouselComponent {
837
847
  this._buttonVisibility();
838
848
  let arrayLength;
839
849
  // set page indicator count with fake array, to use in template
840
- if (this.loop && this.visibleSlidesCount > 1) {
850
+ if (this.loop && this._visibleSlidesNumericCount > 1) {
841
851
  // If loop with multi item visible.
842
852
  arrayLength = this.slides.length;
843
853
  }
844
854
  else {
845
- arrayLength = this.slides.length - this.visibleSlidesCount + 1;
855
+ arrayLength = this.slides.length - this._visibleSlidesNumericCount + 1;
846
856
  }
847
857
  const pageIndicatorsIfZeroCount = this.slides.length === 0 ? 0 : 1;
848
858
  this.pageIndicatorsCountArray = new Array(arrayLength > 0 ? arrayLength : pageIndicatorsIfZeroCount);
849
859
  this._goToFirstItem();
850
860
  this.slides.forEach((_slide, index) => {
851
861
  if (index >= this.currentActiveSlidesStartIndex &&
852
- index < this.currentActiveSlidesStartIndex + this.visibleSlidesCount) {
862
+ index < this.currentActiveSlidesStartIndex + this._visibleSlidesNumericCount) {
853
863
  _slide.visibility = 'visible';
854
864
  }
855
865
  else {
@@ -869,7 +879,7 @@ class CarouselComponent {
869
879
  /** @hidden Initialize config for Carousel service */
870
880
  _initializeServiceConfig() {
871
881
  this._config.vertical = this.vertical;
872
- this._config.elementsAtOnce = this.visibleSlidesCount;
882
+ this._config.elementsAtOnce = this._visibleSlidesNumericCount;
873
883
  this._config.gestureSupport = this.swipeEnabled;
874
884
  this._config.infinite = this.loop;
875
885
  this._config.transition = String(this.slideTransitionDuration) + 'ms';
@@ -920,7 +930,7 @@ class CarouselComponent {
920
930
  else {
921
931
  firstActiveSlideIndex = this.currentActiveSlidesStartIndex;
922
932
  }
923
- for (let activeSlideIndex = 0; activeSlideIndex < this.visibleSlidesCount; activeSlideIndex++) {
933
+ for (let activeSlideIndex = 0; activeSlideIndex < this._visibleSlidesNumericCount; activeSlideIndex++) {
924
934
  const index = firstActiveSlideIndex + activeSlideIndex;
925
935
  const slide = this.slides.get(index);
926
936
  if (slide) {
@@ -936,7 +946,7 @@ class CarouselComponent {
936
946
  _manageSlideVisibility(firstActiveSlideIndex) {
937
947
  setTimeout(() => {
938
948
  this.slides.forEach((_slides, index) => {
939
- if (index >= firstActiveSlideIndex && index < firstActiveSlideIndex + this.visibleSlidesCount) {
949
+ if (index >= firstActiveSlideIndex && index < firstActiveSlideIndex + this._visibleSlidesNumericCount) {
940
950
  if (_slides.visibility === 'hidden') {
941
951
  _slides.visibility = 'visible';
942
952
  }
@@ -989,7 +999,7 @@ class CarouselComponent {
989
999
  }
990
1000
  }
991
1001
  /**
992
- * @hidden Making slides visible when slides are dragged. Otherwise it looses the effect.
1002
+ * @hidden Making slides visible when slides are dragged. Otherwise, it looses the effect.
993
1003
  */
994
1004
  _onSlideDrag(isDragging) {
995
1005
  if (isDragging) {
@@ -1012,11 +1022,52 @@ class CarouselComponent {
1012
1022
  */
1013
1023
  _resizeContentContainer() {
1014
1024
  merge(resizeObservable(this.slideContainer.nativeElement), resizeObservable(this.carouselContainer.nativeElement))
1015
- .pipe(debounceTime(30), takeUntil(this._onDestroy$))
1025
+ .pipe(debounceTime(100), takeUntil(this._onDestroy$))
1016
1026
  .subscribe(() => {
1017
- const { width } = this.carouselContainer.nativeElement.getBoundingClientRect();
1018
- let maxSize = 0;
1019
- for (const slide of this.slides.toArray().slice(this.currentActiveSlidesStartIndex)) {
1027
+ const { width, slides } = this._getFittingSlidesAndWidth();
1028
+ if (this.visibleSlidesCount === 'auto') {
1029
+ this._visibleSlidesNumericCount = slides;
1030
+ const totalSlides = this.slides.length;
1031
+ let needleSlideIndex = this.currentActiveSlidesStartIndex;
1032
+ // If amount of slides insufficient to fill whole carousel, slide back a bit.
1033
+ if (this.currentActiveSlidesStartIndex + slides > totalSlides) {
1034
+ needleSlideIndex =
1035
+ this.currentActiveSlidesStartIndex -
1036
+ (this.currentActiveSlidesStartIndex + slides - totalSlides);
1037
+ }
1038
+ const needleSlide = this.slides.get(needleSlideIndex);
1039
+ this.currentActiveSlidesStartIndex = needleSlideIndex;
1040
+ this._carouselService.active = needleSlide;
1041
+ // Refresh carousel config and transition to the current slide.
1042
+ this._initializeCarousel();
1043
+ this._carouselService.goToItem(needleSlide);
1044
+ this._notifySlideChange(SlideDirection.None);
1045
+ }
1046
+ if (this._slidesWrapperSize !== width) {
1047
+ this._slidesWrapperSize = width;
1048
+ }
1049
+ this._changeDetectorRef.detectChanges();
1050
+ });
1051
+ }
1052
+ /**
1053
+ * @hidden
1054
+ * Calculates how many slides can be shown within current carousel viewport.
1055
+ * @returns Object containing fitting slides count and total width of those slides.
1056
+ */
1057
+ _getFittingSlidesAndWidth() {
1058
+ if (!this.carouselContainer) {
1059
+ return {
1060
+ width: 0,
1061
+ slides: 1
1062
+ };
1063
+ }
1064
+ const { width } = this.carouselContainer.nativeElement.getBoundingClientRect();
1065
+ let maxSize = 0;
1066
+ let slidesCount = 0;
1067
+ const carouselSlides = this.slides.toArray();
1068
+ const previousSlides = carouselSlides.splice(0, this.currentActiveSlidesStartIndex);
1069
+ const getSlides = (slides) => {
1070
+ for (const slide of slides) {
1020
1071
  const slideWidth = slide.getWidth();
1021
1072
  if (!slideWidth) {
1022
1073
  break;
@@ -1026,13 +1077,26 @@ class CarouselComponent {
1026
1077
  break;
1027
1078
  }
1028
1079
  maxSize = newSize;
1080
+ slidesCount++;
1029
1081
  }
1030
- if (this._slidesWrapperSize === maxSize) {
1031
- return;
1032
- }
1033
- this._slidesWrapperSize = maxSize;
1034
- this._changeDetectorRef.detectChanges();
1035
- });
1082
+ };
1083
+ getSlides(carouselSlides);
1084
+ // If with of the rest of the slides is lesser than carouse's viewport, add previous slides to it.
1085
+ if (maxSize < width) {
1086
+ getSlides(previousSlides);
1087
+ }
1088
+ return {
1089
+ width: maxSize,
1090
+ slides: slidesCount
1091
+ };
1092
+ }
1093
+ /** @hidden */
1094
+ _getVisibleSlidesCount() {
1095
+ if (this._visibleSlidesCount !== 'auto') {
1096
+ return this._visibleSlidesCount;
1097
+ }
1098
+ const { slides } = this._getFittingSlidesAndWidth();
1099
+ return slides;
1036
1100
  }
1037
1101
  }
1038
1102
  CarouselComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: CarouselComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: CarouselService }, { token: i2.RtlService, optional: true }], target: i0.ɵɵFactoryTarget.Component });