@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
@@ -549,7 +549,7 @@ class CarouselComponent {
549
549
  this._changeDetectorRef = _changeDetectorRef;
550
550
  this._carouselService = _carouselService;
551
551
  this._rtlService = _rtlService;
552
- /** Id for the Carousel. */
552
+ /** ID for the Carousel. */
553
553
  this.id = `fd-carousel-${carouselCounter++}`;
554
554
  /** Sets aria-label attribute for carousel */
555
555
  this.ariaLabel = null;
@@ -579,8 +579,6 @@ class CarouselComponent {
579
579
  this.swipeEnabled = true;
580
580
  /** Is carousel is vertical. Default value is false. */
581
581
  this.vertical = false;
582
- /** Number of items to be visible at a time */
583
- this.visibleSlidesCount = 1;
584
582
  /** An event that is emitted after a slide transition has happened */
585
583
  this.slideChange = new EventEmitter();
586
584
  /**
@@ -604,6 +602,10 @@ class CarouselComponent {
604
602
  /** @hidden */
605
603
  this._slidesWrapperSize = 0;
606
604
  /** @hidden */
605
+ this._visibleSlidesCount = 1;
606
+ /** @hidden */
607
+ this._visibleSlidesNumericCount = 1;
608
+ /** @hidden */
607
609
  this._resourceStrings = CarouselResourceStringsEN;
608
610
  /** @hidden */
609
611
  this._config = {};
@@ -627,6 +629,14 @@ class CarouselComponent {
627
629
  get resourceStrings() {
628
630
  return this._resourceStrings;
629
631
  }
632
+ /** Number of items to be visible at a time */
633
+ set visibleSlidesCount(value) {
634
+ this._visibleSlidesCount = value;
635
+ this._visibleSlidesNumericCount = this._getVisibleSlidesCount();
636
+ }
637
+ get visibleSlidesCount() {
638
+ return this._visibleSlidesCount;
639
+ }
630
640
  /**
631
641
  * @hidden Returns the `tabIndex` of the carousel component.
632
642
  */
@@ -671,16 +681,16 @@ class CarouselComponent {
671
681
  ngAfterViewInit() {
672
682
  this._initializeServiceConfig();
673
683
  this._carouselService.initialise(this._config, this.slides, this.slideContainer);
674
- this._previousVisibleSlidesCount = this.visibleSlidesCount;
684
+ this._previousVisibleSlidesCount = this._visibleSlidesNumericCount;
675
685
  this._resizeContentContainer();
676
686
  }
677
687
  /** @hidden */
678
688
  ngAfterViewChecked() {
679
- if (this._previousVisibleSlidesCount && this._previousVisibleSlidesCount !== this.visibleSlidesCount) {
689
+ if (this._previousVisibleSlidesCount && this._previousVisibleSlidesCount !== this._visibleSlidesNumericCount) {
680
690
  this._initializeCarousel();
681
691
  this._initializeServiceConfig();
682
692
  this._carouselService.updateConfig(this._config);
683
- this._previousVisibleSlidesCount = this.visibleSlidesCount;
693
+ this._previousVisibleSlidesCount = this._visibleSlidesNumericCount;
684
694
  this._changeDetectorRef.detectChanges();
685
695
  }
686
696
  }
@@ -805,8 +815,8 @@ class CarouselComponent {
805
815
  this.rightButtonDisabled = true;
806
816
  this.leftButtonDisabled = false;
807
817
  }
808
- else if (this.visibleSlidesCount > 1 &&
809
- this.currentActiveSlidesStartIndex + this.visibleSlidesCount >= this.slides.length) {
818
+ else if (this._visibleSlidesNumericCount > 1 &&
819
+ this.currentActiveSlidesStartIndex + this._visibleSlidesNumericCount >= this.slides.length) {
810
820
  this.rightButtonDisabled = true;
811
821
  }
812
822
  else {
@@ -841,19 +851,19 @@ class CarouselComponent {
841
851
  this._buttonVisibility();
842
852
  let arrayLength;
843
853
  // set page indicator count with fake array, to use in template
844
- if (this.loop && this.visibleSlidesCount > 1) {
854
+ if (this.loop && this._visibleSlidesNumericCount > 1) {
845
855
  // If loop with multi item visible.
846
856
  arrayLength = this.slides.length;
847
857
  }
848
858
  else {
849
- arrayLength = this.slides.length - this.visibleSlidesCount + 1;
859
+ arrayLength = this.slides.length - this._visibleSlidesNumericCount + 1;
850
860
  }
851
861
  const pageIndicatorsIfZeroCount = this.slides.length === 0 ? 0 : 1;
852
862
  this.pageIndicatorsCountArray = new Array(arrayLength > 0 ? arrayLength : pageIndicatorsIfZeroCount);
853
863
  this._goToFirstItem();
854
864
  this.slides.forEach((_slide, index) => {
855
865
  if (index >= this.currentActiveSlidesStartIndex &&
856
- index < this.currentActiveSlidesStartIndex + this.visibleSlidesCount) {
866
+ index < this.currentActiveSlidesStartIndex + this._visibleSlidesNumericCount) {
857
867
  _slide.visibility = 'visible';
858
868
  }
859
869
  else {
@@ -873,7 +883,7 @@ class CarouselComponent {
873
883
  /** @hidden Initialize config for Carousel service */
874
884
  _initializeServiceConfig() {
875
885
  this._config.vertical = this.vertical;
876
- this._config.elementsAtOnce = this.visibleSlidesCount;
886
+ this._config.elementsAtOnce = this._visibleSlidesNumericCount;
877
887
  this._config.gestureSupport = this.swipeEnabled;
878
888
  this._config.infinite = this.loop;
879
889
  this._config.transition = String(this.slideTransitionDuration) + 'ms';
@@ -924,7 +934,7 @@ class CarouselComponent {
924
934
  else {
925
935
  firstActiveSlideIndex = this.currentActiveSlidesStartIndex;
926
936
  }
927
- for (let activeSlideIndex = 0; activeSlideIndex < this.visibleSlidesCount; activeSlideIndex++) {
937
+ for (let activeSlideIndex = 0; activeSlideIndex < this._visibleSlidesNumericCount; activeSlideIndex++) {
928
938
  const index = firstActiveSlideIndex + activeSlideIndex;
929
939
  const slide = this.slides.get(index);
930
940
  if (slide) {
@@ -940,7 +950,7 @@ class CarouselComponent {
940
950
  _manageSlideVisibility(firstActiveSlideIndex) {
941
951
  setTimeout(() => {
942
952
  this.slides.forEach((_slides, index) => {
943
- if (index >= firstActiveSlideIndex && index < firstActiveSlideIndex + this.visibleSlidesCount) {
953
+ if (index >= firstActiveSlideIndex && index < firstActiveSlideIndex + this._visibleSlidesNumericCount) {
944
954
  if (_slides.visibility === 'hidden') {
945
955
  _slides.visibility = 'visible';
946
956
  }
@@ -994,7 +1004,7 @@ class CarouselComponent {
994
1004
  }
995
1005
  }
996
1006
  /**
997
- * @hidden Making slides visible when slides are dragged. Otherwise it looses the effect.
1007
+ * @hidden Making slides visible when slides are dragged. Otherwise, it looses the effect.
998
1008
  */
999
1009
  _onSlideDrag(isDragging) {
1000
1010
  if (isDragging) {
@@ -1017,11 +1027,52 @@ class CarouselComponent {
1017
1027
  */
1018
1028
  _resizeContentContainer() {
1019
1029
  merge(resizeObservable(this.slideContainer.nativeElement), resizeObservable(this.carouselContainer.nativeElement))
1020
- .pipe(debounceTime(30), takeUntil(this._onDestroy$))
1030
+ .pipe(debounceTime(100), takeUntil(this._onDestroy$))
1021
1031
  .subscribe(() => {
1022
- const { width } = this.carouselContainer.nativeElement.getBoundingClientRect();
1023
- let maxSize = 0;
1024
- for (const slide of this.slides.toArray().slice(this.currentActiveSlidesStartIndex)) {
1032
+ const { width, slides } = this._getFittingSlidesAndWidth();
1033
+ if (this.visibleSlidesCount === 'auto') {
1034
+ this._visibleSlidesNumericCount = slides;
1035
+ const totalSlides = this.slides.length;
1036
+ let needleSlideIndex = this.currentActiveSlidesStartIndex;
1037
+ // If amount of slides insufficient to fill whole carousel, slide back a bit.
1038
+ if (this.currentActiveSlidesStartIndex + slides > totalSlides) {
1039
+ needleSlideIndex =
1040
+ this.currentActiveSlidesStartIndex -
1041
+ (this.currentActiveSlidesStartIndex + slides - totalSlides);
1042
+ }
1043
+ const needleSlide = this.slides.get(needleSlideIndex);
1044
+ this.currentActiveSlidesStartIndex = needleSlideIndex;
1045
+ this._carouselService.active = needleSlide;
1046
+ // Refresh carousel config and transition to the current slide.
1047
+ this._initializeCarousel();
1048
+ this._carouselService.goToItem(needleSlide);
1049
+ this._notifySlideChange(SlideDirection.None);
1050
+ }
1051
+ if (this._slidesWrapperSize !== width) {
1052
+ this._slidesWrapperSize = width;
1053
+ }
1054
+ this._changeDetectorRef.detectChanges();
1055
+ });
1056
+ }
1057
+ /**
1058
+ * @hidden
1059
+ * Calculates how many slides can be shown within current carousel viewport.
1060
+ * @returns Object containing fitting slides count and total width of those slides.
1061
+ */
1062
+ _getFittingSlidesAndWidth() {
1063
+ if (!this.carouselContainer) {
1064
+ return {
1065
+ width: 0,
1066
+ slides: 1
1067
+ };
1068
+ }
1069
+ const { width } = this.carouselContainer.nativeElement.getBoundingClientRect();
1070
+ let maxSize = 0;
1071
+ let slidesCount = 0;
1072
+ const carouselSlides = this.slides.toArray();
1073
+ const previousSlides = carouselSlides.splice(0, this.currentActiveSlidesStartIndex);
1074
+ const getSlides = (slides) => {
1075
+ for (const slide of slides) {
1025
1076
  const slideWidth = slide.getWidth();
1026
1077
  if (!slideWidth) {
1027
1078
  break;
@@ -1031,13 +1082,26 @@ class CarouselComponent {
1031
1082
  break;
1032
1083
  }
1033
1084
  maxSize = newSize;
1085
+ slidesCount++;
1034
1086
  }
1035
- if (this._slidesWrapperSize === maxSize) {
1036
- return;
1037
- }
1038
- this._slidesWrapperSize = maxSize;
1039
- this._changeDetectorRef.detectChanges();
1040
- });
1087
+ };
1088
+ getSlides(carouselSlides);
1089
+ // If with of the rest of the slides is lesser than carouse's viewport, add previous slides to it.
1090
+ if (maxSize < width) {
1091
+ getSlides(previousSlides);
1092
+ }
1093
+ return {
1094
+ width: maxSize,
1095
+ slides: slidesCount
1096
+ };
1097
+ }
1098
+ /** @hidden */
1099
+ _getVisibleSlidesCount() {
1100
+ if (this._visibleSlidesCount !== 'auto') {
1101
+ return this._visibleSlidesCount;
1102
+ }
1103
+ const { slides } = this._getFittingSlidesAndWidth();
1104
+ return slides;
1041
1105
  }
1042
1106
  }
1043
1107
  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 });