@agorapulse/ui-components 13.2.2 → 13.2.3

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.
@@ -45,7 +45,7 @@ import moment from 'moment';
45
45
  import * as i2$1 from 'ngx-daterangepicker-material';
46
46
  import { NgxDaterangepickerMd } from 'ngx-daterangepicker-material';
47
47
  import * as i1$3 from '@angular/animations';
48
- import { animate, style, trigger, transition } from '@angular/animations';
48
+ import { animate, style, trigger, transition, keyframes } from '@angular/animations';
49
49
  import { ComponentPortal, PortalInjector } from '@angular/cdk/portal';
50
50
  import { Subject, of, fromEvent, BehaviorSubject } from 'rxjs';
51
51
  import { switchMap, delay, takeUntil, debounceTime, distinctUntilChanged, tap, catchError, map } from 'rxjs/operators';
@@ -3283,28 +3283,30 @@ class MultiStyleTextDirective {
3283
3283
  for (const child of this.childrenCreated) {
3284
3284
  this.renderer.removeChild(this.elRef.nativeElement, child);
3285
3285
  }
3286
- MultiStyleTextDirective.parse(fullText).forEach((part) => {
3287
- if (part.clazz || part.clickName) {
3288
- // Parsed item with styling classes and/or event listening.
3289
- const span = this.renderer.createElement('span');
3290
- const text = this.renderer.createText(part.content);
3291
- this.renderer.appendChild(span, text);
3292
- if (part.clazz) {
3293
- part.clazz.forEach(clazz => this.renderer.addClass(span, clazz));
3286
+ if (fullText && fullText.length > 0) {
3287
+ MultiStyleTextDirective.parse(fullText).forEach((part) => {
3288
+ if (part.clazz || part.clickName) {
3289
+ // Parsed item with styling classes and/or event listening.
3290
+ const span = this.renderer.createElement('span');
3291
+ const text = this.renderer.createText(part.content);
3292
+ this.renderer.appendChild(span, text);
3293
+ if (part.clazz) {
3294
+ part.clazz.forEach(clazz => this.renderer.addClass(span, clazz));
3295
+ }
3296
+ if (part.clickName) {
3297
+ this.renderer.listen(span, 'click', () => this.partEvent.emit(part.clickName));
3298
+ }
3299
+ this.renderer.appendChild(this.elRef.nativeElement, span);
3300
+ this.childrenCreated.push(span);
3294
3301
  }
3295
- if (part.clickName) {
3296
- this.renderer.listen(span, 'click', () => this.partEvent.emit(part.clickName));
3302
+ else {
3303
+ // Specific of part without styling classes (could be used to get event listening only)
3304
+ const text = this.renderer.createText(part.content);
3305
+ this.renderer.appendChild(this.elRef.nativeElement, text);
3306
+ this.childrenCreated.push(text);
3297
3307
  }
3298
- this.renderer.appendChild(this.elRef.nativeElement, span);
3299
- this.childrenCreated.push(span);
3300
- }
3301
- else {
3302
- // Specific of part without styling classes (could be used to get event listening only)
3303
- const text = this.renderer.createText(part.content);
3304
- this.renderer.appendChild(this.elRef.nativeElement, text);
3305
- this.childrenCreated.push(text);
3306
- }
3307
- });
3308
+ });
3309
+ }
3308
3310
  }
3309
3311
  static parse(toParse) {
3310
3312
  const parts = [];
@@ -3392,6 +3394,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3392
3394
  type: Output
3393
3395
  }] } });
3394
3396
 
3397
+ const ANIMATION_STYLES = new Map([
3398
+ ['position', 'absolute'],
3399
+ ['bottom', '0'],
3400
+ ['height', '5px'],
3401
+ ['border-radius', '6px'],
3402
+ ['animation', 'slide 1s linear infinite']
3403
+ ]);
3404
+ /**
3405
+ * This directive aims to manage a slider animation.
3406
+ */
3407
+ class LoadingSliderDirective {
3408
+ constructor(elRef, renderer, animationBuilder) {
3409
+ this.elRef = elRef;
3410
+ this.renderer = renderer;
3411
+ this.animationBuilder = animationBuilder;
3412
+ this.loadingSlider = false;
3413
+ this.sliderWidth = '50px';
3414
+ this.sliderColor = '#ff6726';
3415
+ this.sliderAnimationTime = 2000;
3416
+ this.partEvent = new EventEmitter();
3417
+ }
3418
+ ngOnDestroy() {
3419
+ this.removeSlider();
3420
+ }
3421
+ ngOnChanges(changes) {
3422
+ let recreate = false;
3423
+ if (changes.sliderWidth || changes.sliderColor || changes.sliderAnimationTime) {
3424
+ recreate = true;
3425
+ }
3426
+ if (this.loadingSlider) {
3427
+ if (!this.child || recreate) {
3428
+ this.createSlider();
3429
+ }
3430
+ this.showSlider();
3431
+ }
3432
+ else {
3433
+ this.hideSlider();
3434
+ }
3435
+ }
3436
+ createSlider() {
3437
+ this.removeSlider();
3438
+ const div = this.renderer.createElement('div');
3439
+ this.renderer.setStyle(this.elRef.nativeElement, 'position', 'relative');
3440
+ this.renderer.setStyle(this.elRef.nativeElement, 'overflow', 'hidden');
3441
+ this.renderer.addClass(div, 'animation-slider');
3442
+ ANIMATION_STYLES.forEach((value, key) => this.renderer.setStyle(div, key, value));
3443
+ this.renderer.setStyle(div, 'width', this.sliderWidth);
3444
+ this.renderer.setStyle(div, 'background-color', this.sliderColor);
3445
+ // Animate
3446
+ const loaderFadeOutAnimation = this.animationBuilder.build([
3447
+ animate(this.sliderAnimationTime, keyframes([
3448
+ style({ left: "-" + this.sliderWidth, offset: 0 }),
3449
+ style({ left: "calc(100%)", offset: 1 })
3450
+ ]))
3451
+ ]);
3452
+ this.animation = loaderFadeOutAnimation.create(div);
3453
+ const loop = () => {
3454
+ // Stop loop on destroy
3455
+ if (this.animation) {
3456
+ this.animation.reset();
3457
+ this.animation.onDone(loop);
3458
+ this.animation.play();
3459
+ }
3460
+ };
3461
+ this.animation.onDone(loop);
3462
+ this.animation.play();
3463
+ // Append new element
3464
+ this.renderer.appendChild(this.elRef.nativeElement, div);
3465
+ this.child = div;
3466
+ }
3467
+ removeSlider() {
3468
+ if (this.animation) {
3469
+ this.animation.destroy();
3470
+ this.animation = undefined;
3471
+ }
3472
+ if (this.child) {
3473
+ this.renderer.removeChild(this.elRef.nativeElement, this.child);
3474
+ this.child = undefined;
3475
+ }
3476
+ }
3477
+ hideSlider() {
3478
+ if (this.child) {
3479
+ this.renderer.setProperty(this.child, 'hidden', true);
3480
+ }
3481
+ if (this.animation) {
3482
+ this.animation.pause();
3483
+ }
3484
+ }
3485
+ showSlider() {
3486
+ if (this.child) {
3487
+ this.renderer.setProperty(this.child, 'hidden', false);
3488
+ }
3489
+ if (this.animation) {
3490
+ this.animation.reset();
3491
+ this.animation.play();
3492
+ }
3493
+ }
3494
+ }
3495
+ /** @nocollapse */ /** @nocollapse */ LoadingSliderDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LoadingSliderDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$3.AnimationBuilder }], target: i0.ɵɵFactoryTarget.Directive });
3496
+ /** @nocollapse */ /** @nocollapse */ LoadingSliderDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: LoadingSliderDirective, selector: "[loadingSlider]", inputs: { loadingSlider: "loadingSlider", sliderWidth: "sliderWidth", sliderColor: "sliderColor", sliderAnimationTime: "sliderAnimationTime" }, outputs: { partEvent: "partEvent" }, usesOnChanges: true, ngImport: i0 });
3497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LoadingSliderDirective, decorators: [{
3498
+ type: Directive,
3499
+ args: [{
3500
+ // tslint:disable-next-line:directive-selector
3501
+ selector: '[loadingSlider]'
3502
+ }]
3503
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$3.AnimationBuilder }]; }, propDecorators: { loadingSlider: [{
3504
+ type: Input
3505
+ }], sliderWidth: [{
3506
+ type: Input
3507
+ }], sliderColor: [{
3508
+ type: Input
3509
+ }], sliderAnimationTime: [{
3510
+ type: Input
3511
+ }], partEvent: [{
3512
+ type: Output
3513
+ }] } });
3514
+
3395
3515
  // Angular
3396
3516
  class TruncateTooltipDirective {
3397
3517
  constructor(tooltipNeo, elementRef) {
@@ -3527,7 +3647,8 @@ class AgorapulseUiComponentsModule {
3527
3647
  EqualValidatorDirective,
3528
3648
  MultiStyleTextDirective,
3529
3649
  TruncateTooltipDirective,
3530
- TooltipNeoDirective
3650
+ TooltipNeoDirective,
3651
+ LoadingSliderDirective
3531
3652
  ], imports: [AgorapulseUiSymbolModule,
3532
3653
  CommonModule,
3533
3654
  NgxDaterangepickerMd,
@@ -3608,6 +3729,7 @@ class AgorapulseUiComponentsModule {
3608
3729
  MultiStyleTextDirective,
3609
3730
  TruncateTooltipDirective,
3610
3731
  TooltipNeoDirective,
3732
+ LoadingSliderDirective,
3611
3733
  // Modules
3612
3734
  NgSelectModule,
3613
3735
  PopmenuModule,
@@ -3774,6 +3896,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3774
3896
  MultiStyleTextDirective,
3775
3897
  TruncateTooltipDirective,
3776
3898
  TooltipNeoDirective,
3899
+ LoadingSliderDirective,
3777
3900
  ],
3778
3901
  imports: [
3779
3902
  AgorapulseUiSymbolModule,
@@ -3859,6 +3982,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3859
3982
  MultiStyleTextDirective,
3860
3983
  TruncateTooltipDirective,
3861
3984
  TooltipNeoDirective,
3985
+ LoadingSliderDirective,
3862
3986
  // Modules
3863
3987
  NgSelectModule,
3864
3988
  PopmenuModule,
@@ -4009,5 +4133,5 @@ function generateCodeStatus(text, type) {
4009
4133
  * Generated bundle index. Do not edit.
4010
4134
  */
4011
4135
 
4012
- export { AddCommentComponent, AgorapulseUiComponentsModule, AutosizeTextareaDirective, AvatarComponent, ConfirmModalComponent, DatepickerComponent, DatepickerMode, DefaultImageDirective, DotsStepperComponent, EllipsisDirective, EqualValidatorDirective, FeatureOnboardingComponent, FrozenGifDirective, ImageCarouselComponent, InstagramCarouselItemType, LabelComponent, LabelListComponent, LabelsSelectorComponent, MediaDisplayOverlayDialogComponent, ModalComponent, MultiStyleTextDirective, NotificationComponent, OverlayDialogComponent, OverlayDialogService, OverlayInDivComponent, PaginatorButtonComponent, PaginatorComponent, PasswordInputComponent, PlaceComponent, PlaceListComponent, PopmenuComponent, PopmenuDirective, PopmenuModule, SlideToggleComponent, SnackBarComponent, SnackbarsThreadComponent, SnackbarsThreadService, SplashscreenComponent, StarRatingComponent, StepperComponent, TimeFormat, TimepickerComponent, TooltipNeoDirective, TruncateTooltipDirective, TryPopupComponent, generateCodeStatus };
4136
+ export { AddCommentComponent, AgorapulseUiComponentsModule, AutosizeTextareaDirective, AvatarComponent, ConfirmModalComponent, DatepickerComponent, DatepickerMode, DefaultImageDirective, DotsStepperComponent, EllipsisDirective, EqualValidatorDirective, FeatureOnboardingComponent, FrozenGifDirective, ImageCarouselComponent, InstagramCarouselItemType, LabelComponent, LabelListComponent, LabelsSelectorComponent, LoadingSliderDirective, MediaDisplayOverlayDialogComponent, ModalComponent, MultiStyleTextDirective, NotificationComponent, OverlayDialogComponent, OverlayDialogService, OverlayInDivComponent, PaginatorButtonComponent, PaginatorComponent, PasswordInputComponent, PlaceComponent, PlaceListComponent, PopmenuComponent, PopmenuDirective, PopmenuModule, SlideToggleComponent, SnackBarComponent, SnackbarsThreadComponent, SnackbarsThreadService, SplashscreenComponent, StarRatingComponent, StepperComponent, TimeFormat, TimepickerComponent, TooltipNeoDirective, TruncateTooltipDirective, TryPopupComponent, generateCodeStatus };
4013
4137
  //# sourceMappingURL=agorapulse-ui-components.mjs.map