@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,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Optional, Host, HostListener, HostBinding, Output, Input, forwardRef, ElementRef, ChangeDetectionStrategy, Component, ViewChild, ContentChild, Injectable, NgModule } from '@angular/core';
2
+ import { inject, EventEmitter, Directive, HostListener, HostBinding, Output, Input, Renderer2, ElementRef, NgZone, TemplateRef, ViewContainerRef, ChangeDetectorRef, forwardRef, ChangeDetectionStrategy, Component, ViewChild, ContentChild, Injectable, NgModule } from '@angular/core';
3
3
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
4
- import * as i1 from '@angular/forms';
5
- import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
4
+ import * as i2 from '@angular/forms';
5
+ import { NgModel, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
6
6
  import { TemplatePortalDirective, CdkPortalOutlet } from '@angular/cdk/portal';
7
7
  import { ENTER } from '@angular/cdk/keycodes';
8
8
  import { Subject, merge, fromEvent } from 'rxjs';
@@ -11,13 +11,12 @@ import { mixinControlValueAccessor, mixinDisabled } from '@covalent/core/common'
11
11
  import * as i3 from '@angular/material/button';
12
12
  import { MatButtonModule } from '@angular/material/button';
13
13
  import { MatIcon } from '@angular/material/icon';
14
- import * as i1$1 from '@angular/common';
14
+ import * as i1 from '@angular/common';
15
15
  import { CommonModule } from '@angular/common';
16
- import * as i1$2 from '@angular/common/http';
17
- import { HttpRequest, HttpParams, HttpHeaders, HttpEventType } from '@angular/common/http';
16
+ import { HttpClient, HttpRequest, HttpParams, HttpHeaders, HttpEventType } from '@angular/common/http';
18
17
 
19
18
  class TdFileSelectDirective {
20
- model;
19
+ model = inject(NgModel, { optional: true, host: true });
21
20
  _multiple = false;
22
21
  /**
23
22
  * multiple?: boolean
@@ -40,9 +39,6 @@ class TdFileSelectDirective {
40
39
  get multipleBinding() {
41
40
  return this._multiple ? '' : undefined;
42
41
  }
43
- constructor(model) {
44
- this.model = model;
45
- }
46
42
  /**
47
43
  * Listens to 'change' host event to get [HTMLInputElement] files.
48
44
  * Emits the 'fileSelect' event with a [FileList] or [File] depending if 'multiple' attr exists in host.
@@ -64,7 +60,7 @@ class TdFileSelectDirective {
64
60
  }
65
61
  }
66
62
  }
67
- static ɵfac = function TdFileSelectDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileSelectDirective)(i0.ɵɵdirectiveInject(i1.NgModel, 9)); };
63
+ static ɵfac = function TdFileSelectDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileSelectDirective)(); };
68
64
  static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TdFileSelectDirective, selectors: [["", "tdFileSelect", ""]], hostVars: 1, hostBindings: function TdFileSelectDirective_HostBindings(rf, ctx) { if (rf & 1) {
69
65
  i0.ɵɵlistener("change", function TdFileSelectDirective_change_HostBindingHandler($event) { return ctx.onChange($event); });
70
66
  } if (rf & 2) {
@@ -76,11 +72,7 @@ class TdFileSelectDirective {
76
72
  args: [{
77
73
  selector: '[tdFileSelect]',
78
74
  }]
79
- }], () => [{ type: i1.NgModel, decorators: [{
80
- type: Optional
81
- }, {
82
- type: Host
83
- }] }], { multiple: [{
75
+ }], null, { multiple: [{
84
76
  type: Input
85
77
  }], fileSelect: [{
86
78
  type: Output
@@ -95,9 +87,9 @@ class TdFileSelectDirective {
95
87
  class TdFileDropBase {
96
88
  }
97
89
  class TdFileDropDirective {
98
- _renderer;
99
- _element;
100
- _ngZone;
90
+ _renderer = inject(Renderer2);
91
+ _element = inject(ElementRef);
92
+ _ngZone = inject(NgZone);
101
93
  _multiple = false;
102
94
  _dragenterListener;
103
95
  _dragleaveListener;
@@ -129,11 +121,6 @@ class TdFileDropDirective {
129
121
  get disabledBinding() {
130
122
  return this.disabled ? '' : undefined;
131
123
  }
132
- constructor(_renderer, _element, _ngZone) {
133
- this._renderer = _renderer;
134
- this._element = _element;
135
- this._ngZone = _ngZone;
136
- }
137
124
  ngOnInit() {
138
125
  this._ngZone.runOutsideAngular(() => {
139
126
  // Listens to 'dragenter' host event to add animation class 'drop-zone' which can be overriden in host.
@@ -211,7 +198,7 @@ class TdFileDropDirective {
211
198
  event.preventDefault();
212
199
  event.stopPropagation();
213
200
  }
214
- static ɵfac = function TdFileDropDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileDropDirective)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.NgZone)); };
201
+ static ɵfac = function TdFileDropDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileDropDirective)(); };
215
202
  static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TdFileDropDirective, selectors: [["", "tdFileDrop", ""]], hostVars: 2, hostBindings: function TdFileDropDirective_HostBindings(rf, ctx) { if (rf & 1) {
216
203
  i0.ɵɵlistener("drop", function TdFileDropDirective_drop_HostBindingHandler($event) { return ctx.onDrop($event); });
217
204
  } if (rf & 2) {
@@ -221,7 +208,7 @@ class TdFileDropDirective {
221
208
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdFileDropDirective, [{
222
209
  type: Directive,
223
210
  args: [{ selector: '[tdFileDrop]' }]
224
- }], () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }], { multiple: [{
211
+ }], null, { multiple: [{
225
212
  type: Input
226
213
  }], disabled: [{
227
214
  type: Input
@@ -242,10 +229,12 @@ const _c0$1 = ["fileInputButton"];
242
229
  const _c1 = ["fileInput"];
243
230
  const _c2 = ["*"];
244
231
  class TdFileInputLabelDirective extends TemplatePortalDirective {
245
- constructor(templateRef, viewContainerRef) {
232
+ constructor() {
233
+ const templateRef = inject(TemplateRef);
234
+ const viewContainerRef = inject(ViewContainerRef);
246
235
  super(templateRef, viewContainerRef);
247
236
  }
248
- static ɵfac = function TdFileInputLabelDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileInputLabelDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); };
237
+ static ɵfac = function TdFileInputLabelDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileInputLabelDirective)(); };
249
238
  static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TdFileInputLabelDirective, selectors: [["ng-template", "tdFileInputLabel", ""]], features: [i0.ɵɵInheritDefinitionFeature] });
250
239
  }
251
240
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdFileInputLabelDirective, [{
@@ -253,7 +242,7 @@ class TdFileInputLabelDirective extends TemplatePortalDirective {
253
242
  args: [{
254
243
  selector: '[tdFileInputLabel]ng-template',
255
244
  }]
256
- }], () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }], null); })();
245
+ }], () => [], null); })();
257
246
  class TdFileInputBase {
258
247
  _changeDetectorRef;
259
248
  constructor(_changeDetectorRef) {
@@ -262,8 +251,8 @@ class TdFileInputBase {
262
251
  }
263
252
  const _TdFileInputMixinBase = mixinControlValueAccessor(mixinDisabled(TdFileInputBase));
264
253
  class TdFileInputComponent extends _TdFileInputMixinBase {
265
- _ngZone;
266
- _renderer;
254
+ _ngZone = inject(NgZone);
255
+ _renderer = inject(Renderer2);
267
256
  _multiple = false;
268
257
  /** The native `<button class="td-file-input"></button>` element */
269
258
  _inputButton;
@@ -300,10 +289,9 @@ class TdFileInputComponent extends _TdFileInputMixinBase {
300
289
  */
301
290
  selectFile = new EventEmitter();
302
291
  _destroy$ = new Subject();
303
- constructor(_ngZone, _renderer, _changeDetectorRef) {
292
+ constructor() {
293
+ const _changeDetectorRef = inject(ChangeDetectorRef);
304
294
  super(_changeDetectorRef);
305
- this._ngZone = _ngZone;
306
- this._renderer = _renderer;
307
295
  }
308
296
  ngOnInit() {
309
297
  this._ngZone.runOutsideAngular(() => {
@@ -341,7 +329,7 @@ class TdFileInputComponent extends _TdFileInputMixinBase {
341
329
  setDisabledState(isDisabled) {
342
330
  this.disabled = isDisabled;
343
331
  }
344
- static ɵfac = function TdFileInputComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileInputComponent)(i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
332
+ static ɵfac = function TdFileInputComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileInputComponent)(); };
345
333
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TdFileInputComponent, selectors: [["td-file-input"]], viewQuery: function TdFileInputComponent_Query(rf, ctx) { if (rf & 1) {
346
334
  i0.ɵɵviewQuery(_c0$1, 7, ElementRef);
347
335
  i0.ɵɵviewQuery(_c1, 7);
@@ -381,7 +369,7 @@ class TdFileInputComponent extends _TdFileInputMixinBase {
381
369
  multi: true,
382
370
  },
383
371
  ], selector: 'td-file-input', inputs: ['disabled', 'value'], imports: [MatButtonModule, TdFileDropDirective, TdFileSelectDirective], template: "<button\n #fileInputButton\n mat-stroked-button\n class=\"td-file-input\"\n type=\"button\"\n [color]=\"color\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n (fileDrop)=\"handleSelect($event)\"\n tdFileDrop\n>\n <ng-content></ng-content>\n</button>\n<input\n #fileInput\n class=\"td-file-input-hidden\"\n type=\"file\"\n [attr.accept]=\"accept\"\n (fileSelect)=\"handleSelect($event)\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n tdFileSelect\n/>\n", styles: [":host .td-file-input{padding-left:8px;padding-right:8px}:host input.td-file-input-hidden{display:none}:host ::ng-deep .mdc-button__label{display:flex;align-items:center}:host .drop-zone{border-radius:3px}:host .drop-zone *{pointer-events:none}\n"] }]
384
- }], () => [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], { _inputButton: [{
372
+ }], () => [], { _inputButton: [{
385
373
  type: ViewChild,
386
374
  args: ['fileInputButton', { static: true, read: ElementRef }]
387
375
  }], _inputElement: [{
@@ -396,7 +384,7 @@ class TdFileInputComponent extends _TdFileInputMixinBase {
396
384
  }], selectFile: [{
397
385
  type: Output
398
386
  }] }); })();
399
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdFileInputComponent, { className: "TdFileInputComponent", filePath: "file-input/file-input.component.ts", lineNumber: 71 }); })();
387
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdFileInputComponent, { className: "TdFileInputComponent", filePath: "file-input/file-input.component.ts", lineNumber: 72 }); })();
400
388
 
401
389
  const _c0 = ["*"];
402
390
  function TdFileUploadComponent_td_file_input_0_ng_template_1_Template(rf, ctx) { }
@@ -439,7 +427,7 @@ class TdFileUploadBase {
439
427
  }
440
428
  }
441
429
  class TdFileUploadComponent {
442
- _changeDetectorRef;
430
+ _changeDetectorRef = inject(ChangeDetectorRef);
443
431
  _multiple = false;
444
432
  _required = false;
445
433
  _disabled = false;
@@ -512,10 +500,7 @@ class TdFileUploadComponent {
512
500
  * Event emitted when cancel button is clicked.
513
501
  */
514
502
  // eslint-disable-next-line @angular-eslint/no-output-native
515
- cancel = new EventEmitter(); // TODO: check if we can change the name of this emitter
516
- constructor(_changeDetectorRef) {
517
- this._changeDetectorRef = _changeDetectorRef;
518
- }
503
+ cancel = new EventEmitter();
519
504
  writeValue(value) {
520
505
  this.value = value;
521
506
  this._changeDetectorRef.markForCheck();
@@ -561,7 +546,7 @@ class TdFileUploadComponent {
561
546
  this._cancel();
562
547
  }
563
548
  }
564
- static ɵfac = function TdFileUploadComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileUploadComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
549
+ static ɵfac = function TdFileUploadComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileUploadComponent)(); };
565
550
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TdFileUploadComponent, selectors: [["td-file-upload"]], contentQueries: function TdFileUploadComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
566
551
  i0.ɵɵcontentQuery(dirIndex, TdFileInputLabelDirective, 5);
567
552
  } if (rf & 2) {
@@ -585,7 +570,9 @@ class TdFileUploadComponent {
585
570
  i0.ɵɵproperty("ngIf", !ctx.value);
586
571
  i0.ɵɵadvance();
587
572
  i0.ɵɵproperty("ngIf", ctx.value);
588
- } }, dependencies: [CommonModule, i1$1.NgIf, FormsModule, i1.NgControlStatus, i1.NgModel, TdFileInputComponent, MatButtonModule, i3.MatButton, i3.MatIconButton, MatIcon, CdkPortalOutlet], styles: [".td-file-upload[_ngcontent-%COMP%]{padding-left:8px;padding-right:8px}.td-file-upload-cancel[_ngcontent-%COMP%]{height:24px;width:24px;position:relative;top:24px;left:-12px} [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{border-radius:12px;vertical-align:baseline}.drop-zone[_ngcontent-%COMP%]{border-radius:3px}.drop-zone[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{pointer-events:none}"], changeDetection: 0 });
573
+ } }, dependencies: [CommonModule, i1.NgIf, FormsModule, i2.NgControlStatus, i2.NgModel, TdFileInputComponent,
574
+ MatButtonModule, i3.MatButton, i3.MatIconButton, MatIcon,
575
+ CdkPortalOutlet], styles: [".td-file-upload[_ngcontent-%COMP%]{padding-left:8px;padding-right:8px}.td-file-upload-cancel[_ngcontent-%COMP%]{height:24px;width:24px;position:relative;top:24px;left:-12px} [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{border-radius:12px;vertical-align:baseline}.drop-zone[_ngcontent-%COMP%]{border-radius:3px}.drop-zone[_ngcontent-%COMP%] *[_ngcontent-%COMP%]{pointer-events:none}"], changeDetection: 0 });
589
576
  }
590
577
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdFileUploadComponent, [{
591
578
  type: Component,
@@ -595,8 +582,15 @@ class TdFileUploadComponent {
595
582
  useExisting: forwardRef(() => TdFileUploadComponent),
596
583
  multi: true,
597
584
  },
598
- ], selector: 'td-file-upload', imports: [CommonModule, FormsModule, TdFileInputComponent, MatButtonModule, MatIcon, CdkPortalOutlet], template: "<td-file-input\n *ngIf=\"!value\"\n [(ngModel)]=\"value\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n [accept]=\"accept\"\n [color]=\"defaultColor\"\n (selectFile)=\"handleSelect(value)\"\n>\n <ng-template [cdkPortalOutlet]=\"inputLabel\" [ngIf]=\"true\"></ng-template>\n</td-file-input>\n<div *ngIf=\"value\">\n <button\n #fileUpload\n class=\"td-file-upload\"\n mat-raised-button\n type=\"button\"\n [color]=\"activeColor\"\n (keyup.delete)=\"_cancel()\"\n (keyup.backspace)=\"_cancel()\"\n (keyup.escape)=\"_cancel()\"\n (click)=\"uploadPressed()\"\n >\n <ng-content></ng-content>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-file-upload-cancel\"\n [color]=\"cancelColor\"\n (click)=\"_cancel()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n</div>\n", styles: [".td-file-upload{padding-left:8px;padding-right:8px}.td-file-upload-cancel{height:24px;width:24px;position:relative;top:24px;left:-12px}::ng-deep [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel mat-icon{border-radius:12px;vertical-align:baseline}.drop-zone{border-radius:3px}.drop-zone *{pointer-events:none}\n"] }]
599
- }], () => [{ type: i0.ChangeDetectorRef }], { fileInput: [{
585
+ ], selector: 'td-file-upload', imports: [
586
+ CommonModule,
587
+ FormsModule,
588
+ TdFileInputComponent,
589
+ MatButtonModule,
590
+ MatIcon,
591
+ CdkPortalOutlet,
592
+ ], template: "<td-file-input\n *ngIf=\"!value\"\n [(ngModel)]=\"value\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n [accept]=\"accept\"\n [color]=\"defaultColor\"\n (selectFile)=\"handleSelect(value)\"\n>\n <ng-template [cdkPortalOutlet]=\"inputLabel\" [ngIf]=\"true\"></ng-template>\n</td-file-input>\n<div *ngIf=\"value\">\n <button\n #fileUpload\n class=\"td-file-upload\"\n mat-raised-button\n type=\"button\"\n [color]=\"activeColor\"\n (keyup.delete)=\"_cancel()\"\n (keyup.backspace)=\"_cancel()\"\n (keyup.escape)=\"_cancel()\"\n (click)=\"uploadPressed()\"\n >\n <ng-content></ng-content>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-file-upload-cancel\"\n [color]=\"cancelColor\"\n (click)=\"_cancel()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n</div>\n", styles: [".td-file-upload{padding-left:8px;padding-right:8px}.td-file-upload-cancel{height:24px;width:24px;position:relative;top:24px;left:-12px}::ng-deep [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel mat-icon{border-radius:12px;vertical-align:baseline}.drop-zone{border-radius:3px}.drop-zone *{pointer-events:none}\n"] }]
593
+ }], null, { fileInput: [{
600
594
  type: ViewChild,
601
595
  args: [TdFileInputComponent]
602
596
  }], inputLabel: [{
@@ -625,10 +619,10 @@ class TdFileUploadComponent {
625
619
  }], cancel: [{
626
620
  type: Output
627
621
  }] }); })();
628
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdFileUploadComponent, { className: "TdFileUploadComponent", filePath: "file-upload/file-upload.component.ts", lineNumber: 41 }); })();
622
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TdFileUploadComponent, { className: "TdFileUploadComponent", filePath: "file-upload/file-upload.component.ts", lineNumber: 53 }); })();
629
623
 
630
624
  class TdFileService {
631
- _http;
625
+ _http = inject(HttpClient, { optional: true });
632
626
  _progressSubject = new Subject();
633
627
  _progressObservable;
634
628
  /**
@@ -643,8 +637,7 @@ class TdFileService {
643
637
  * @param _http the http client instance
644
638
  * @breaking-change 3.0.0 remove 'Optional' decorator once the legay upload method is removed
645
639
  */
646
- constructor(_http) {
647
- this._http = _http;
640
+ constructor() {
648
641
  this._progressObservable = this._progressSubject.asObservable();
649
642
  }
650
643
  /**
@@ -678,14 +671,12 @@ class TdFileService {
678
671
  break;
679
672
  }
680
673
  }
681
- static ɵfac = function TdFileService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileService)(i0.ɵɵinject(i1$2.HttpClient, 8)); };
674
+ static ɵfac = function TdFileService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TdFileService)(); };
682
675
  static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TdFileService, factory: TdFileService.ɵfac });
683
676
  }
684
677
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TdFileService, [{
685
678
  type: Injectable
686
- }], () => [{ type: i1$2.HttpClient, decorators: [{
687
- type: Optional
688
- }] }], null); })();
679
+ }], () => [], null); })();
689
680
 
690
681
  const TD_FILE = [
691
682
  TdFileSelectDirective,