@covalent/core 11.0.0-beta.2 → 11.0.0-beta.4

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.
@@ -1,13 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, Optional, SkipSelf, ComponentFactoryResolver, Injector, Directive, Input, NgModule } from '@angular/core';
2
+ import { inject, ElementRef, ChangeDetectorRef, Component, ComponentFactoryResolver, Injector, Injectable, Optional, SkipSelf, ViewContainerRef, TemplateRef, Directive, Input, NgModule } from '@angular/core';
3
3
  import { tdFadeInOutAnimation } from '@covalent/core/common';
4
4
  import { CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
5
5
  import { MatProgressBar } from '@angular/material/progress-bar';
6
6
  import { MatProgressSpinner } from '@angular/material/progress-spinner';
7
7
  import * as i1 from '@angular/common';
8
8
  import { CommonModule } from '@angular/common';
9
- import * as i1$1 from '@angular/cdk/overlay';
10
- import { OverlayConfig, Overlay } from '@angular/cdk/overlay';
9
+ import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
11
10
  import { Subject } from 'rxjs';
12
11
  import { distinctUntilChanged } from 'rxjs/operators';
13
12
 
@@ -47,8 +46,8 @@ var LoadingStyle;
47
46
  })(LoadingStyle || (LoadingStyle = {}));
48
47
  const TD_CIRCLE_DIAMETER = 40;
49
48
  class TdLoadingComponent {
50
- _elementRef;
51
- _changeDetectorRef;
49
+ _elementRef = inject(ElementRef);
50
+ _changeDetectorRef = inject(ChangeDetectorRef);
52
51
  _mode = LoadingMode.Indeterminate;
53
52
  _defaultMode = LoadingMode.Indeterminate;
54
53
  _value = 0;
@@ -97,10 +96,6 @@ class TdLoadingComponent {
97
96
  * Sets theme color of [TdLoadingComponent] rendered.
98
97
  */
99
98
  color = 'primary';
100
- constructor(_elementRef, _changeDetectorRef) {
101
- this._elementRef = _elementRef;
102
- this._changeDetectorRef = _changeDetectorRef;
103
- }
104
99
  ngDoCheck() {
105
100
  // When overlay is used and the host width has a value greater than 1px
106
101
  // set the circle diameter when possible incase the loading component was rendered in a hidden state
@@ -202,7 +197,7 @@ class TdLoadingComponent {
202
197
  }
203
198
  return 0;
204
199
  }
205
- static ɵfac = function TdLoadingComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
200
+ static ɵfac = function TdLoadingComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingComponent)(); };
206
201
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TdLoadingComponent, selectors: [["td-loading"]], decls: 5, vars: 14, consts: [[1, "td-loading-wrapper"], [1, "td-loading"], [3, "mode", "value", "color", "diameter", "strokeWidth", 4, "ngIf"], [3, "mode", "value", "color", 4, "ngIf"], [3, "cdkPortalOutlet"], [3, "mode", "value", "color", "diameter", "strokeWidth"], [3, "mode", "value", "color"]], template: function TdLoadingComponent_Template(rf, ctx) { if (rf & 1) {
207
202
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1);
208
203
  i0.ɵɵtemplate(2, TdLoadingComponent_mat_progress_spinner_2_Template, 1, 5, "mat-progress-spinner", 2)(3, TdLoadingComponent_mat_progress_bar_3_Template, 1, 3, "mat-progress-bar", 3);
@@ -221,33 +216,21 @@ class TdLoadingComponent {
221
216
  i0.ɵɵproperty("ngIf", ctx.isLinear());
222
217
  i0.ɵɵadvance();
223
218
  i0.ɵɵproperty("cdkPortalOutlet", ctx.content);
224
- } }, dependencies: [CommonModule, i1.NgIf, MatProgressBar,
225
- MatProgressSpinner,
226
- CdkPortalOutlet], styles: [".td-loading-wrapper[_ngcontent-%COMP%]{position:relative;display:block}.td-loading-wrapper.td-fullscreen[_ngcontent-%COMP%]{position:inherit}.td-loading-wrapper[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%] mat-progress-bar[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{bottom:0}"], data: { animation: [tdFadeInOutAnimation] } });
219
+ } }, dependencies: [CommonModule, i1.NgIf, MatProgressBar, MatProgressSpinner, CdkPortalOutlet], styles: [".td-loading-wrapper[_ngcontent-%COMP%]{position:relative;display:block}.td-loading-wrapper.td-fullscreen[_ngcontent-%COMP%]{position:inherit}.td-loading-wrapper[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%] mat-progress-bar[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular[_ngcontent-%COMP%] .td-loading[_ngcontent-%COMP%]{bottom:0}"], data: { animation: [tdFadeInOutAnimation] } });
227
220
  }
228
221
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdLoadingComponent, [{
229
222
  type: Component,
230
- args: [{ selector: 'td-loading', animations: [tdFadeInOutAnimation], imports: [
231
- CommonModule,
232
- MatProgressBar,
233
- MatProgressSpinner,
234
- CdkPortalOutlet,
235
- ], template: "<div\n class=\"td-loading-wrapper\"\n [style.min-height]=\"getHeight()\"\n [class.td-overlay-circular]=\"(isOverlay() || isFullScreen()) && !isLinear()\"\n [class.td-overlay]=\"isOverlay() || isFullScreen()\"\n [class.td-fullscreen]=\"isFullScreen()\"\n>\n <div\n [@tdFadeInOut]=\"animation\"\n [style.min-height]=\"getHeight()\"\n class=\"td-loading\"\n >\n <mat-progress-spinner\n *ngIf=\"isCircular()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n [diameter]=\"getCircleDiameter()\"\n [strokeWidth]=\"getCircleStrokeWidth()\"\n ></mat-progress-spinner>\n <mat-progress-bar\n *ngIf=\"isLinear()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n ></mat-progress-bar>\n </div>\n <ng-template [cdkPortalOutlet]=\"content\"></ng-template>\n</div>\n", styles: [".td-loading-wrapper{position:relative;display:block}.td-loading-wrapper.td-fullscreen{position:inherit}.td-loading-wrapper .td-loading{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay .td-loading{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay .td-loading mat-progress-bar{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular .td-loading{bottom:0}\n"] }]
236
- }], () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], null); })();
237
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdLoadingComponent, { className: "TdLoadingComponent", filePath: "loading.component.ts", lineNumber: 48 }); })();
223
+ args: [{ selector: 'td-loading', animations: [tdFadeInOutAnimation], imports: [CommonModule, MatProgressBar, MatProgressSpinner, CdkPortalOutlet], template: "<div\n class=\"td-loading-wrapper\"\n [style.min-height]=\"getHeight()\"\n [class.td-overlay-circular]=\"(isOverlay() || isFullScreen()) && !isLinear()\"\n [class.td-overlay]=\"isOverlay() || isFullScreen()\"\n [class.td-fullscreen]=\"isFullScreen()\"\n>\n <div\n [@tdFadeInOut]=\"animation\"\n [style.min-height]=\"getHeight()\"\n class=\"td-loading\"\n >\n <mat-progress-spinner\n *ngIf=\"isCircular()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n [diameter]=\"getCircleDiameter()\"\n [strokeWidth]=\"getCircleStrokeWidth()\"\n ></mat-progress-spinner>\n <mat-progress-bar\n *ngIf=\"isLinear()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n ></mat-progress-bar>\n </div>\n <ng-template [cdkPortalOutlet]=\"content\"></ng-template>\n</div>\n", styles: [".td-loading-wrapper{position:relative;display:block}.td-loading-wrapper.td-fullscreen{position:inherit}.td-loading-wrapper .td-loading{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay .td-loading{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay .td-loading mat-progress-bar{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular .td-loading{bottom:0}\n"] }]
224
+ }], null, null); })();
225
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdLoadingComponent, { className: "TdLoadingComponent", filePath: "loading.component.ts", lineNumber: 44 }); })();
238
226
 
239
227
  /**
240
228
  * NOTE: @internal usage only.
241
229
  */
242
230
  class TdLoadingFactory {
243
- _componentFactoryResolver;
244
- _overlay;
245
- _injector;
246
- constructor(_componentFactoryResolver, _overlay, _injector) {
247
- this._componentFactoryResolver = _componentFactoryResolver;
248
- this._overlay = _overlay;
249
- this._injector = _injector;
250
- }
231
+ _componentFactoryResolver = inject(ComponentFactoryResolver);
232
+ _overlay = inject(Overlay);
233
+ _injector = inject(Injector);
251
234
  /**
252
235
  * Uses material `Overlay` services to create a DOM element and attach the loading component
253
236
  * into it. Leveraging the state and configuration from it.
@@ -416,14 +399,14 @@ class TdLoadingFactory {
416
399
  instance.color = options.color;
417
400
  }
418
401
  }
419
- static ɵfac = function TdLoadingFactory_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingFactory)(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(i1$1.Overlay), i0.ɵɵinject(i0.Injector)); };
402
+ static ɵfac = function TdLoadingFactory_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingFactory)(); };
420
403
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TdLoadingFactory, factory: TdLoadingFactory.ɵfac });
421
404
  }
422
405
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdLoadingFactory, [{
423
406
  type: Injectable
424
- }], () => [{ type: i0.ComponentFactoryResolver }, { type: i1$1.Overlay }, { type: i0.Injector }], null); })();
425
- function LOADING_FACTORY_PROVIDER_FACTORY(parent, componentFactoryResolver, overlay, injector) {
426
- return (parent || new TdLoadingFactory(componentFactoryResolver, overlay, injector));
407
+ }], null, null); })();
408
+ function LOADING_FACTORY_PROVIDER_FACTORY(parent) {
409
+ return parent || new TdLoadingFactory();
427
410
  }
428
411
  const LOADING_FACTORY_PROVIDER = {
429
412
  // If there is already a service available, use that. Otherwise, provide a new one.
@@ -460,11 +443,10 @@ class TdLoadingDirectiveConfig extends TdLoadingConfig {
460
443
  }
461
444
  }
462
445
  class TdLoadingService {
463
- _loadingFactory;
446
+ _loadingFactory = inject(TdLoadingFactory);
464
447
  _context = {};
465
448
  _timeouts = {};
466
- constructor(_loadingFactory) {
467
- this._loadingFactory = _loadingFactory;
449
+ constructor() {
468
450
  this.create({
469
451
  name: 'td-loading-main',
470
452
  });
@@ -635,14 +617,14 @@ class TdLoadingService {
635
617
  clearTimeout(this._timeouts[name]);
636
618
  delete this._timeouts[name];
637
619
  }
638
- static ɵfac = function TdLoadingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingService)(i0.ɵɵinject(TdLoadingFactory)); };
620
+ static ɵfac = function TdLoadingService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingService)(); };
639
621
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TdLoadingService, factory: TdLoadingService.ɵfac });
640
622
  }
641
623
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdLoadingService, [{
642
624
  type: Injectable
643
- }], () => [{ type: TdLoadingFactory }], null); })();
644
- function LOADING_PROVIDER_FACTORY(parent, loadingFactory) {
645
- return parent || new TdLoadingService(loadingFactory);
625
+ }], () => [], null); })();
626
+ function LOADING_PROVIDER_FACTORY(parent) {
627
+ return parent || new TdLoadingService();
646
628
  }
647
629
  const LOADING_PROVIDER = {
648
630
  // If there is already a service available, use that. Otherwise, provide a new one.
@@ -661,9 +643,9 @@ class TdLoadingContext {
661
643
  // Constant for generation of the id for the next component
662
644
  let TD_LOADING_NEXT_ID = 0;
663
645
  class TdLoadingDirective {
664
- _viewContainerRef;
665
- _templateRef;
666
- _loadingService;
646
+ _viewContainerRef = inject(ViewContainerRef);
647
+ _templateRef = inject(TemplateRef);
648
+ _loadingService = inject(TdLoadingService);
667
649
  _context = new TdLoadingContext();
668
650
  _loadingRef;
669
651
  /**
@@ -712,11 +694,6 @@ class TdLoadingDirective {
712
694
  * Sets the theme color of the loading component. Defaults to "primary"
713
695
  */
714
696
  color = 'primary';
715
- constructor(_viewContainerRef, _templateRef, _loadingService) {
716
- this._viewContainerRef = _viewContainerRef;
717
- this._templateRef = _templateRef;
718
- this._loadingService = _loadingService;
719
- }
720
697
  /**
721
698
  * Registers component in the DOM, so it will be available when calling resolve/register.
722
699
  */
@@ -750,7 +727,7 @@ class TdLoadingDirective {
750
727
  }, this._viewContainerRef, this._templateRef, this._context);
751
728
  }
752
729
  }
753
- static ɵfac = function TdLoadingDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingDirective)(i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i0.TemplateRef), i0.ɵɵdirectiveInject(TdLoadingService)); };
730
+ static ɵfac = function TdLoadingDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdLoadingDirective)(); };
754
731
  static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TdLoadingDirective, selectors: [["", "tdLoading", ""]], inputs: { name: [0, "tdLoading", "name"], until: [0, "tdLoadingUntil", "until"], type: [0, "tdLoadingType", "type"], mode: [0, "tdLoadingMode", "mode"], strategy: [0, "tdLoadingStrategy", "strategy"], color: [0, "tdLoadingColor", "color"] } });
755
732
  }
756
733
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdLoadingDirective, [{
@@ -758,7 +735,7 @@ class TdLoadingDirective {
758
735
  args: [{
759
736
  selector: '[tdLoading]',
760
737
  }]
761
- }], () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: TdLoadingService }], { name: [{
738
+ }], null, { name: [{
762
739
  type: Input,
763
740
  args: ['tdLoading']
764
741
  }], until: [{