oasys-lib 1.25.4 → 1.26.1

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.
@@ -2175,15 +2175,39 @@
2175
2175
  this.carousel_slides_per_view_laptop = 3;
2176
2176
  this.carousel_slides_per_view_tablet = 2.5;
2177
2177
  this.carousel_slides_per_view_mobile = 1.25;
2178
- // register swiper custom elements
2179
- bundle.register();
2180
2178
  }
2181
2179
  CarouselComponent.prototype.ngOnInit = function () {
2182
- // Initialise swiper
2183
- this.initSwiper();
2180
+ this.setUpIntersectionObserver();
2184
2181
  };
2185
- CarouselComponent.prototype.ngAfterViewInit = function () {
2186
- this.setupScrollbarLayoutProperties();
2182
+ /**
2183
+ * Set up the intersection observer with the relevant options
2184
+ */
2185
+ CarouselComponent.prototype.setUpIntersectionObserver = function () {
2186
+ // Set IntersectionObserver options
2187
+ var options = {
2188
+ root: null,
2189
+ rootMargin: '0px',
2190
+ threshold: 0.5,
2191
+ once: true
2192
+ };
2193
+ // Set up the IntersectionObserver
2194
+ var observer = new IntersectionObserver(this.onIntersection.bind(this), options);
2195
+ observer.observe(this.element.nativeElement);
2196
+ };
2197
+ /**
2198
+ * This function gets called just before the user scrolls this component into view
2199
+ * @param entries - An array of interswection observer entries
2200
+ * @param observer - Intersection observer
2201
+ */
2202
+ CarouselComponent.prototype.onIntersection = function (entries, observer) {
2203
+ var _this = this;
2204
+ entries.forEach(function (entry) {
2205
+ if (entry.isIntersecting) {
2206
+ // Initialise swiper
2207
+ _this.initSwiper();
2208
+ observer.unobserve(entry.target);
2209
+ }
2210
+ });
2187
2211
  };
2188
2212
  CarouselComponent.prototype.getStyle = function (element, style) {
2189
2213
  return this.document.defaultView.getComputedStyle(element, null).getPropertyValue(style);
@@ -2260,6 +2284,8 @@
2260
2284
  Object.assign(swiperEl, swiperParams);
2261
2285
  // and now initialize it
2262
2286
  swiperEl.initialize();
2287
+ // Set up scrollbar and ensure this is recalculated on resize events
2288
+ this.setupScrollbarLayoutProperties();
2263
2289
  swiperEl.addEventListener('resize', function () {
2264
2290
  _this.setupScrollbarLayoutProperties();
2265
2291
  });
@@ -2279,7 +2305,7 @@
2279
2305
  return CarouselComponent;
2280
2306
  }());
2281
2307
  CarouselComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CarouselComponent, deps: [{ token: TokenService }, { token: i6.DOCUMENT }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
2282
- CarouselComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: CarouselComponent, selector: "ui-carousel", inputs: { rewind: "rewind", carousel_overflow: "carousel_overflow", carousel_gap: "carousel_gap", carousel_pagination: "carousel_pagination", carousel_align: "carousel_align", carousel_slides_per_view_desktop: "carousel_slides_per_view_desktop", carousel_slides_per_view_laptop: "carousel_slides_per_view_laptop", carousel_slides_per_view_tablet: "carousel_slides_per_view_tablet", carousel_slides_per_view_mobile: "carousel_slides_per_view_mobile" }, viewQueries: [{ propertyName: "swiper", first: true, predicate: ["swiper"], descendants: true, static: true }, { propertyName: "carouselscrollbarplaceholder", first: true, predicate: ["carouselscrollbarplaceholder"], descendants: true, read: i0.ElementRef }, { propertyName: "carouselctastack", first: true, predicate: ["carouselctastack"], descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<ui-box\nclass=\"ui-carousel\"\n[ngClass]=\"{'ui-carousel-overflow': carousel_overflow}\"\nbox_align_y=\"center\"\nbox_space=\"none\"\nbox_content_fill_width=\"true\">\n\n <ui-stack #carouselctastack>\n <!-- Swiper WebComponent-->\n <swiper-container\n #swiper\n init=\"false\"\n center-insufficient-slides=\"true\"\n prevent-clicks-propagation=\"true\">\n <ng-content></ng-content>\n </swiper-container>\n\n <!-- Custom navigation buttons -->\n <ui-stack stack_direction=\"x\" stack_align=\"center\" *ngIf=\"carousel_pagination === 'scroll-arrows'\">\n <div class=\"ui-carousel-scrollbar-placeholder\" #carouselscrollbarplaceholder></div>\n <ui-box box_space=\"none\" box_fill_mode=\"fit\" [box_space_right]=\"{mobile: 'tight', tablet: 'none', laptop: 'none', desktop: 'none'}\">\n <ui-stack\n *ngIf=\"!(swiper?.swiper?.isBeginning && swiper?.swiper?.isEnd)\"\n stack_direction=\"x\"\n stack_gap=\"near\">\n <!-- Previous button-->\n <ui-button\n class=\"ui-carousel__previous\"\n button_size=\"large\"\n button_icon_placement=\"iconOnly\"\n button_icon=\"arrow-left\"\n button_type=\"secondary\"\n (clicked)=\"previousSlide()\">\n <span #buttontext>Prevous slide</span>\n </ui-button>\n <!-- Next button-->\n <ui-button\n class=\"ui-carousel__next\"\n button_size=\"large\"\n button_icon_placement=\"iconOnly\"\n button_icon=\"arrow-right\"\n button_type=\"secondary\"\n (clicked)=\"nextSlide()\">\n <span #buttontext>Next slide</span>\n </ui-button>\n </ui-stack>\n </ui-box>\n </ui-stack>\n </ui-stack>\n</ui-box>\n", styles: [":root{--swiper-scrollbar-size: 4px}.ui-carousel swiper-container{width:100%}.ui-carousel.ui-carousel-overflow swiper-container{overflow:visible!important}.ui-carousel .ui-carousel-scrollbar-placeholder{width:100%;display:flex;align-self:stretch}\n"], components: [{ type: LayoutBoxComponent, selector: "ui-box", inputs: ["box_space", "box_space_top", "box_space_right", "box_space_bottom", "box_space_left", "box_align_x", "box_align_y", "box_fill_mode", "box_background", "box_content_fill_width"] }, { type: LayoutStackComponent, selector: "ui-stack", inputs: ["stack_gap", "stack_align", "stack_direction", "stack_distribute", "stack_wrap", "stack_collapse_below"] }, { type: OasysButtonComponent, selector: "ui-button", inputs: ["button_icon", "button_icon_placement", "button_size", "button_full_width", "button_type", "button_disabled", "button_text_nowrap", "href"], outputs: ["clicked"] }], directives: [{ type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0__namespace.ViewEncapsulation.None });
2308
+ CarouselComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: CarouselComponent, selector: "ui-carousel", inputs: { rewind: "rewind", carousel_overflow: "carousel_overflow", carousel_gap: "carousel_gap", carousel_pagination: "carousel_pagination", carousel_align: "carousel_align", carousel_slides_per_view_desktop: "carousel_slides_per_view_desktop", carousel_slides_per_view_laptop: "carousel_slides_per_view_laptop", carousel_slides_per_view_tablet: "carousel_slides_per_view_tablet", carousel_slides_per_view_mobile: "carousel_slides_per_view_mobile" }, viewQueries: [{ propertyName: "swiper", first: true, predicate: ["swiper"], descendants: true, static: true }, { propertyName: "carouselscrollbarplaceholder", first: true, predicate: ["carouselscrollbarplaceholder"], descendants: true, read: i0.ElementRef }, { propertyName: "carouselctastack", first: true, predicate: ["carouselctastack"], descendants: true, read: i0.ElementRef }], ngImport: i0__namespace, template: "<ui-box\nclass=\"ui-carousel\"\n[ngClass]=\"{'ui-carousel-overflow': carousel_overflow}\"\nbox_align_y=\"center\"\nbox_space=\"none\"\nbox_content_fill_width=\"true\"\nbox_background=\"transparent\">\n\n <ui-stack #carouselctastack>\n <!-- Swiper WebComponent-->\n <swiper-container\n #swiper\n init=\"false\"\n center-insufficient-slides=\"true\"\n prevent-clicks-propagation=\"true\">\n <ng-content></ng-content>\n </swiper-container>\n\n <!-- Custom navigation buttons -->\n <ui-stack stack_direction=\"x\" stack_align=\"center\" *ngIf=\"carousel_pagination === 'scroll-arrows'\">\n <div class=\"ui-carousel-scrollbar-placeholder\" #carouselscrollbarplaceholder></div>\n <ui-box \n box_space=\"none\" \n box_fill_mode=\"fit\" \n [box_space_right]=\"{mobile: 'tight', tablet: 'none', laptop: 'none', desktop: 'none'}\"\n box_background=\"transparent\">\n <ui-stack\n *ngIf=\"!(swiper?.swiper?.isBeginning && swiper?.swiper?.isEnd)\"\n stack_direction=\"x\"\n stack_gap=\"near\">\n <!-- Previous button-->\n <ui-button\n class=\"ui-carousel__previous\"\n button_size=\"large\"\n button_icon_placement=\"iconOnly\"\n button_icon=\"arrow-left\"\n button_type=\"secondary\"\n (clicked)=\"previousSlide()\">\n <span #buttontext>Prevous slide</span>\n </ui-button>\n <!-- Next button-->\n <ui-button\n class=\"ui-carousel__next\"\n button_size=\"large\"\n button_icon_placement=\"iconOnly\"\n button_icon=\"arrow-right\"\n button_type=\"secondary\"\n (clicked)=\"nextSlide()\">\n <span #buttontext>Next slide</span>\n </ui-button>\n </ui-stack>\n </ui-box>\n </ui-stack>\n </ui-stack>\n</ui-box>\n", styles: [":root{--swiper-scrollbar-size: 4px}.ui-carousel swiper-container{width:100%}.ui-carousel.ui-carousel-overflow swiper-container{overflow:visible!important}.ui-carousel .ui-carousel-scrollbar-placeholder{width:100%;display:flex;align-self:stretch}\n"], components: [{ type: LayoutBoxComponent, selector: "ui-box", inputs: ["box_space", "box_space_top", "box_space_right", "box_space_bottom", "box_space_left", "box_align_x", "box_align_y", "box_fill_mode", "box_background", "box_content_fill_width"] }, { type: LayoutStackComponent, selector: "ui-stack", inputs: ["stack_gap", "stack_align", "stack_direction", "stack_distribute", "stack_wrap", "stack_collapse_below"] }, { type: OasysButtonComponent, selector: "ui-button", inputs: ["button_icon", "button_icon_placement", "button_size", "button_full_width", "button_type", "button_disabled", "button_text_nowrap", "href"], outputs: ["clicked"] }], directives: [{ type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], encapsulation: i0__namespace.ViewEncapsulation.None });
2283
2309
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CarouselComponent, decorators: [{
2284
2310
  type: i0.Component,
2285
2311
  args: [{
@@ -2322,6 +2348,7 @@
2322
2348
  type: i0.Input
2323
2349
  }] } });
2324
2350
 
2351
+ bundle.register();
2325
2352
  var OasysCarouselModule = /** @class */ (function () {
2326
2353
  function OasysCarouselModule() {
2327
2354
  }