@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';
@@ -3263,28 +3263,30 @@ class MultiStyleTextDirective {
3263
3263
  for (const child of this.childrenCreated) {
3264
3264
  this.renderer.removeChild(this.elRef.nativeElement, child);
3265
3265
  }
3266
- MultiStyleTextDirective.parse(fullText).forEach((part) => {
3267
- if (part.clazz || part.clickName) {
3268
- // Parsed item with styling classes and/or event listening.
3269
- const span = this.renderer.createElement('span');
3270
- const text = this.renderer.createText(part.content);
3271
- this.renderer.appendChild(span, text);
3272
- if (part.clazz) {
3273
- part.clazz.forEach(clazz => this.renderer.addClass(span, clazz));
3266
+ if (fullText && fullText.length > 0) {
3267
+ MultiStyleTextDirective.parse(fullText).forEach((part) => {
3268
+ if (part.clazz || part.clickName) {
3269
+ // Parsed item with styling classes and/or event listening.
3270
+ const span = this.renderer.createElement('span');
3271
+ const text = this.renderer.createText(part.content);
3272
+ this.renderer.appendChild(span, text);
3273
+ if (part.clazz) {
3274
+ part.clazz.forEach(clazz => this.renderer.addClass(span, clazz));
3275
+ }
3276
+ if (part.clickName) {
3277
+ this.renderer.listen(span, 'click', () => this.partEvent.emit(part.clickName));
3278
+ }
3279
+ this.renderer.appendChild(this.elRef.nativeElement, span);
3280
+ this.childrenCreated.push(span);
3274
3281
  }
3275
- if (part.clickName) {
3276
- this.renderer.listen(span, 'click', () => this.partEvent.emit(part.clickName));
3282
+ else {
3283
+ // Specific of part without styling classes (could be used to get event listening only)
3284
+ const text = this.renderer.createText(part.content);
3285
+ this.renderer.appendChild(this.elRef.nativeElement, text);
3286
+ this.childrenCreated.push(text);
3277
3287
  }
3278
- this.renderer.appendChild(this.elRef.nativeElement, span);
3279
- this.childrenCreated.push(span);
3280
- }
3281
- else {
3282
- // Specific of part without styling classes (could be used to get event listening only)
3283
- const text = this.renderer.createText(part.content);
3284
- this.renderer.appendChild(this.elRef.nativeElement, text);
3285
- this.childrenCreated.push(text);
3286
- }
3287
- });
3288
+ });
3289
+ }
3288
3290
  }
3289
3291
  static parse(toParse) {
3290
3292
  const parts = [];
@@ -3372,6 +3374,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3372
3374
  type: Output
3373
3375
  }] } });
3374
3376
 
3377
+ const ANIMATION_STYLES = new Map([
3378
+ ['position', 'absolute'],
3379
+ ['bottom', '0'],
3380
+ ['height', '5px'],
3381
+ ['border-radius', '6px'],
3382
+ ['animation', 'slide 1s linear infinite']
3383
+ ]);
3384
+ /**
3385
+ * This directive aims to manage a slider animation.
3386
+ */
3387
+ class LoadingSliderDirective {
3388
+ constructor(elRef, renderer, animationBuilder) {
3389
+ this.elRef = elRef;
3390
+ this.renderer = renderer;
3391
+ this.animationBuilder = animationBuilder;
3392
+ this.loadingSlider = false;
3393
+ this.sliderWidth = '50px';
3394
+ this.sliderColor = '#ff6726';
3395
+ this.sliderAnimationTime = 2000;
3396
+ this.partEvent = new EventEmitter();
3397
+ }
3398
+ ngOnDestroy() {
3399
+ this.removeSlider();
3400
+ }
3401
+ ngOnChanges(changes) {
3402
+ let recreate = false;
3403
+ if (changes.sliderWidth || changes.sliderColor || changes.sliderAnimationTime) {
3404
+ recreate = true;
3405
+ }
3406
+ if (this.loadingSlider) {
3407
+ if (!this.child || recreate) {
3408
+ this.createSlider();
3409
+ }
3410
+ this.showSlider();
3411
+ }
3412
+ else {
3413
+ this.hideSlider();
3414
+ }
3415
+ }
3416
+ createSlider() {
3417
+ this.removeSlider();
3418
+ const div = this.renderer.createElement('div');
3419
+ this.renderer.setStyle(this.elRef.nativeElement, 'position', 'relative');
3420
+ this.renderer.setStyle(this.elRef.nativeElement, 'overflow', 'hidden');
3421
+ this.renderer.addClass(div, 'animation-slider');
3422
+ ANIMATION_STYLES.forEach((value, key) => this.renderer.setStyle(div, key, value));
3423
+ this.renderer.setStyle(div, 'width', this.sliderWidth);
3424
+ this.renderer.setStyle(div, 'background-color', this.sliderColor);
3425
+ // Animate
3426
+ const loaderFadeOutAnimation = this.animationBuilder.build([
3427
+ animate(this.sliderAnimationTime, keyframes([
3428
+ style({ left: "-" + this.sliderWidth, offset: 0 }),
3429
+ style({ left: "calc(100%)", offset: 1 })
3430
+ ]))
3431
+ ]);
3432
+ this.animation = loaderFadeOutAnimation.create(div);
3433
+ const loop = () => {
3434
+ // Stop loop on destroy
3435
+ if (this.animation) {
3436
+ this.animation.reset();
3437
+ this.animation.onDone(loop);
3438
+ this.animation.play();
3439
+ }
3440
+ };
3441
+ this.animation.onDone(loop);
3442
+ this.animation.play();
3443
+ // Append new element
3444
+ this.renderer.appendChild(this.elRef.nativeElement, div);
3445
+ this.child = div;
3446
+ }
3447
+ removeSlider() {
3448
+ if (this.animation) {
3449
+ this.animation.destroy();
3450
+ this.animation = undefined;
3451
+ }
3452
+ if (this.child) {
3453
+ this.renderer.removeChild(this.elRef.nativeElement, this.child);
3454
+ this.child = undefined;
3455
+ }
3456
+ }
3457
+ hideSlider() {
3458
+ if (this.child) {
3459
+ this.renderer.setProperty(this.child, 'hidden', true);
3460
+ }
3461
+ if (this.animation) {
3462
+ this.animation.pause();
3463
+ }
3464
+ }
3465
+ showSlider() {
3466
+ if (this.child) {
3467
+ this.renderer.setProperty(this.child, 'hidden', false);
3468
+ }
3469
+ if (this.animation) {
3470
+ this.animation.reset();
3471
+ this.animation.play();
3472
+ }
3473
+ }
3474
+ }
3475
+ /** @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 });
3476
+ /** @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 });
3477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: LoadingSliderDirective, decorators: [{
3478
+ type: Directive,
3479
+ args: [{
3480
+ // tslint:disable-next-line:directive-selector
3481
+ selector: '[loadingSlider]'
3482
+ }]
3483
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$3.AnimationBuilder }]; }, propDecorators: { loadingSlider: [{
3484
+ type: Input
3485
+ }], sliderWidth: [{
3486
+ type: Input
3487
+ }], sliderColor: [{
3488
+ type: Input
3489
+ }], sliderAnimationTime: [{
3490
+ type: Input
3491
+ }], partEvent: [{
3492
+ type: Output
3493
+ }] } });
3494
+
3375
3495
  // Angular
3376
3496
  class TruncateTooltipDirective {
3377
3497
  constructor(tooltipNeo, elementRef) {
@@ -3507,7 +3627,8 @@ class AgorapulseUiComponentsModule {
3507
3627
  EqualValidatorDirective,
3508
3628
  MultiStyleTextDirective,
3509
3629
  TruncateTooltipDirective,
3510
- TooltipNeoDirective], imports: [AgorapulseUiSymbolModule,
3630
+ TooltipNeoDirective,
3631
+ LoadingSliderDirective], imports: [AgorapulseUiSymbolModule,
3511
3632
  CommonModule,
3512
3633
  NgxDaterangepickerMd,
3513
3634
  FormsModule,
@@ -3587,6 +3708,7 @@ class AgorapulseUiComponentsModule {
3587
3708
  MultiStyleTextDirective,
3588
3709
  TruncateTooltipDirective,
3589
3710
  TooltipNeoDirective,
3711
+ LoadingSliderDirective,
3590
3712
  // Modules
3591
3713
  NgSelectModule,
3592
3714
  PopmenuModule,
@@ -3753,6 +3875,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3753
3875
  MultiStyleTextDirective,
3754
3876
  TruncateTooltipDirective,
3755
3877
  TooltipNeoDirective,
3878
+ LoadingSliderDirective,
3756
3879
  ],
3757
3880
  imports: [
3758
3881
  AgorapulseUiSymbolModule,
@@ -3838,6 +3961,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
3838
3961
  MultiStyleTextDirective,
3839
3962
  TruncateTooltipDirective,
3840
3963
  TooltipNeoDirective,
3964
+ LoadingSliderDirective,
3841
3965
  // Modules
3842
3966
  NgSelectModule,
3843
3967
  PopmenuModule,
@@ -3988,5 +4112,5 @@ function generateCodeStatus(text, type) {
3988
4112
  * Generated bundle index. Do not edit.
3989
4113
  */
3990
4114
 
3991
- 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 };
4115
+ 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 };
3992
4116
  //# sourceMappingURL=agorapulse-ui-components.mjs.map