@covalent/core 4.1.8 → 4.1.11-develop.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.
@@ -11,8 +11,9 @@ import { MatIconModule } from '@angular/material/icon';
11
11
  import * as i3 from '@angular/material/button';
12
12
  import { MatButtonModule } from '@angular/material/button';
13
13
  import { trigger, state, style, transition, animate, AUTO_STYLE } from '@angular/animations';
14
- import { debounceTime, skip, takeUntil } from 'rxjs/operators';
15
14
  import { Subject, fromEvent, noop } from 'rxjs';
15
+ import { debounceTime, skip, takeUntil } from 'rxjs/operators';
16
+ import { mixinControlValueAccessor } from '@covalent/core/common';
16
17
  import * as i1 from '@angular/cdk/bidi';
17
18
  import * as i2 from '@angular/material/form-field';
18
19
 
@@ -21,8 +22,10 @@ class TdSearchInputBase {
21
22
  this._changeDetectorRef = _changeDetectorRef;
22
23
  }
23
24
  }
24
- class TdSearchInputComponent {
25
+ const _TdSearchInputMixinBase = mixinControlValueAccessor(TdSearchInputBase);
26
+ class TdSearchInputComponent extends _TdSearchInputMixinBase {
25
27
  constructor(_dir, _changeDetectorRef, _ngZone) {
28
+ super(_changeDetectorRef);
26
29
  this._dir = _dir;
27
30
  this._changeDetectorRef = _changeDetectorRef;
28
31
  this._ngZone = _ngZone;
@@ -93,16 +96,6 @@ class TdSearchInputComponent {
93
96
  ngOnDestroy() {
94
97
  this._destroy$.next();
95
98
  }
96
- writeValue(value) {
97
- this.value = value;
98
- this._changeDetectorRef.markForCheck();
99
- }
100
- registerOnChange() {
101
- noop;
102
- }
103
- registerOnTouched() {
104
- noop;
105
- }
106
99
  /**
107
100
  * Method to focus to underlying input.
108
101
  */
@@ -141,7 +134,7 @@ TdSearchInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
141
134
  useExisting: forwardRef(() => TdSearchInputComponent),
142
135
  multi: true,
143
136
  },
144
- ], viewQueries: [{ propertyName: "_input", first: true, predicate: MatInput, descendants: true, static: true }, { propertyName: "_searchElement", first: true, predicate: ["searchElement"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div class=\"td-search-input\">\n <mat-form-field\n class=\"td-search-input-field\"\n [class.mat-hide-underline]=\"!showUnderline\"\n [appearance]=\"appearance\"\n floatLabel=\"never\"\n >\n <input\n matInput\n #searchElement\n type=\"search\"\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n (blur)=\"handleBlur()\"\n (keyup.enter)=\"handleSearch($event)\"\n />\n <span\n matSuffix\n *ngIf=\"\n appearance === 'fill' ||\n appearance === 'outline' ||\n appearance === 'standard'\n \"\n >\n <ng-template [ngTemplateOutlet]=\"clearButton\"></ng-template>\n </span>\n </mat-form-field>\n <ng-template\n *ngIf=\"!appearance || appearance === 'legacy'\"\n [ngTemplateOutlet]=\"clearButton\"\n ></ng-template>\n</div>\n<ng-template #clearButton>\n <button\n mat-icon-button\n class=\"td-search-input-clear\"\n type=\"button\"\n [@searchState]=\"\n searchElement.value ? 'show' : isRTL ? 'hide-left' : 'hide-right'\n \"\n (click)=\"clearSearch()\"\n >\n <mat-icon>{{ clearIcon }}</mat-icon>\n </button>\n</ng-template>\n", styles: [":host .td-search-input{overflow-x:hidden;box-sizing:border-box;display:flex;flex-direction:row;align-items:baseline;align-content:center;max-width:100%;justify-content:flex-end}:host .td-search-input .td-search-input-field{flex:1}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper .mat-form-field-flex{height:52px}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper .mat-form-field-underline{bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper .mat-form-field-infix{bottom:.4em}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper .mat-form-field-underline{bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-legacy .mat-form-field-infix{align-self:center}:host .td-search-input ::ng-deep mat-form-field .mat-input-element{caret-color:currentColor}:host .td-search-input ::ng-deep mat-form-field.mat-hide-underline .mat-form-field-underline{display:none}:host .td-search-input .td-search-input-clear{flex:0 0 auto;align-self:center}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
137
+ ], viewQueries: [{ propertyName: "_input", first: true, predicate: MatInput, descendants: true, static: true }, { propertyName: "_searchElement", first: true, predicate: ["searchElement"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"td-search-input\">\n <mat-form-field\n class=\"td-search-input-field\"\n [class.mat-hide-underline]=\"!showUnderline\"\n [appearance]=\"appearance\"\n floatLabel=\"never\"\n >\n <input\n matInput\n #searchElement\n type=\"search\"\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n (blur)=\"handleBlur()\"\n (keyup.enter)=\"handleSearch($event)\"\n />\n <span\n matSuffix\n *ngIf=\"\n appearance === 'fill' ||\n appearance === 'outline' ||\n appearance === 'standard'\n \"\n >\n <ng-template [ngTemplateOutlet]=\"clearButton\"></ng-template>\n </span>\n </mat-form-field>\n <ng-template\n *ngIf=\"!appearance || appearance === 'legacy'\"\n [ngTemplateOutlet]=\"clearButton\"\n ></ng-template>\n</div>\n<ng-template #clearButton>\n <button\n mat-icon-button\n class=\"td-search-input-clear\"\n type=\"button\"\n [@searchState]=\"\n searchElement.value ? 'show' : isRTL ? 'hide-left' : 'hide-right'\n \"\n (click)=\"clearSearch()\"\n >\n <mat-icon>{{ clearIcon }}</mat-icon>\n </button>\n</ng-template>\n", styles: [":host .td-search-input{overflow-x:hidden;box-sizing:border-box;display:flex;flex-direction:row;align-items:baseline;align-content:center;max-width:100%;justify-content:flex-end}:host .td-search-input .td-search-input-field{flex:1}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-outline .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper .mat-form-field-flex{height:52px}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-fill .mat-form-field-wrapper .mat-form-field-underline{bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper{padding-bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper .mat-form-field-infix{bottom:.4em}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-standard .mat-form-field-wrapper .mat-form-field-underline{bottom:0}:host .td-search-input ::ng-deep mat-form-field.mat-form-field-appearance-legacy .mat-form-field-infix{align-self:center}:host .td-search-input ::ng-deep mat-form-field .mat-input-element{caret-color:currentColor}:host .td-search-input ::ng-deep mat-form-field.mat-hide-underline .mat-form-field-underline{display:none}:host .td-search-input .td-search-input-clear{flex:0 0 auto;align-self:center}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatSuffix, selector: "[matSuffix]" }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
145
138
  trigger('searchState', [
146
139
  state('hide-left', style({
147
140
  transform: 'translateX(-150%)',
@@ -435,5 +428,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
435
428
  * Generated bundle index. Do not edit.
436
429
  */
437
430
 
438
- export { CovalentSearchModule, TdSearchBoxBase, TdSearchBoxComponent, TdSearchInputBase, TdSearchInputComponent };
431
+ export { CovalentSearchModule, TdSearchBoxBase, TdSearchBoxComponent, TdSearchInputBase, TdSearchInputComponent, _TdSearchInputMixinBase };
439
432
  //# sourceMappingURL=covalent-core-search.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"covalent-core-search.mjs","sources":["../../../../libs/angular/search/src/search-input/search-input.component.ts","../../../../libs/angular/search/src/search-input/search-input.component.html","../../../../libs/angular/search/src/search-box/search-box.component.ts","../../../../libs/angular/search/src/search-box/search-box.component.html","../../../../libs/angular/search/src/search.module.ts","../../../../libs/angular/search/src/covalent-core-search.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n OnInit,\n Input,\n Output,\n EventEmitter,\n Optional,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n forwardRef,\n OnDestroy,\n ElementRef,\n NgZone,\n} from '@angular/core';\nimport {\n trigger,\n state,\n style,\n transition,\n animate,\n} from '@angular/animations';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Dir } from '@angular/cdk/bidi';\nimport { MatInput } from '@angular/material/input';\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\n\nimport { debounceTime, skip, takeUntil } from 'rxjs/operators';\nimport { fromEvent, noop, Subject } from 'rxjs';\n\nexport class TdSearchInputBase {\n constructor(public _changeDetectorRef: ChangeDetectorRef) {}\n}\n\n@Component({\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdSearchInputComponent),\n multi: true,\n },\n ],\n selector: 'td-search-input',\n templateUrl: './search-input.component.html',\n styleUrls: ['./search-input.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('searchState', [\n state(\n 'hide-left',\n style({\n transform: 'translateX(-150%)',\n display: 'none',\n })\n ),\n state(\n 'hide-right',\n style({\n transform: 'translateX(150%)',\n display: 'none',\n })\n ),\n state(\n 'show',\n style({\n transform: 'translateX(0%)',\n display: 'block',\n })\n ),\n transition('* => show', animate('200ms ease-in')),\n transition('show => *', animate('200ms ease-out')),\n ]),\n ],\n})\nexport class TdSearchInputComponent\n implements ControlValueAccessor, OnInit, OnDestroy\n{\n @ViewChild(MatInput, { static: true }) _input?: MatInput;\n\n @ViewChild('searchElement', { static: true, read: ElementRef })\n _searchElement!: ElementRef<HTMLInputElement>;\n\n /**\n * appearance?: MatFormFieldAppearance\n * Appearance style for the underlying input component.\n */\n @Input() appearance: MatFormFieldAppearance = 'legacy';\n\n /**\n * showUnderline?: boolean\n * Sets if the input underline should be visible. Defaults to 'false'.\n */\n @Input() showUnderline = false;\n\n /**\n * debounce?: number\n * Debounce timeout between keypresses. Defaults to 400.\n */\n @Input() debounce = 400;\n\n /**\n * placeholder?: string\n * Placeholder for the underlying input component.\n */\n @Input() placeholder = '';\n\n /**\n * clearIcon?: string\n * The icon used to clear the search input.\n * Defaults to 'cancel' icon.\n */\n @Input() clearIcon = 'cancel';\n\n @Input() value?: unknown;\n\n /**\n * searchDebounce: function($event)\n * Event emitted after the [debounce] timeout.\n */\n @Output() searchDebounce: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * search: function($event)\n * Event emitted after the key enter has been pressed.\n */\n @Output() search: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * clear: function()\n * Event emitted after the clear icon has been clicked.\n */\n @Output() clear: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * blur: function()\n * Event emitted after the blur event has been called in underlying input.\n */\n @Output() blurSearch: EventEmitter<void> = new EventEmitter<void>();\n\n get isRTL(): boolean {\n if (this._dir) {\n return this._dir.dir === 'rtl';\n }\n return false;\n }\n\n private _destroy$ = new Subject<void>();\n\n constructor(\n @Optional() private _dir: Dir,\n private _changeDetectorRef: ChangeDetectorRef,\n private _ngZone: NgZone\n ) {}\n\n ngOnInit(): void {\n this._input?.ngControl?.valueChanges\n ?.pipe(\n debounceTime(this.debounce),\n skip(1), // skip first change when value is set to undefined\n takeUntil(this._destroy$)\n )\n .subscribe((value: string) => {\n this._searchTermChanged(value);\n });\n\n this._ngZone.runOutsideAngular(() =>\n fromEvent(this._searchElement.nativeElement, 'search')\n .pipe(takeUntil(this._destroy$))\n .subscribe(this._stopPropagation)\n );\n }\n\n ngOnDestroy(): void {\n this._destroy$.next();\n }\n\n writeValue(value: unknown): void {\n this.value = value;\n this._changeDetectorRef.markForCheck();\n }\n\n registerOnChange(): void {\n noop;\n }\n\n registerOnTouched(): void {\n noop;\n }\n\n /**\n * Method to focus to underlying input.\n */\n focus(): void {\n this._input?.focus();\n }\n\n handleBlur(): void {\n this.blurSearch.emit();\n }\n\n handleSearch(event: Event): void {\n this._stopPropagation(event);\n if (typeof this.value == 'string') {\n this.search.emit(this.value);\n }\n }\n\n /**\n * Method to clear the underlying input.\n */\n clearSearch(): void {\n this.value = '';\n this._changeDetectorRef.markForCheck();\n this.clear.emit();\n }\n\n private _searchTermChanged(value: string): void {\n this.searchDebounce.emit(value);\n }\n\n private _stopPropagation(event: Event): void {\n event.stopPropagation();\n }\n}\n","<div class=\"td-search-input\">\n <mat-form-field\n class=\"td-search-input-field\"\n [class.mat-hide-underline]=\"!showUnderline\"\n [appearance]=\"appearance\"\n floatLabel=\"never\"\n >\n <input\n matInput\n #searchElement\n type=\"search\"\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n (blur)=\"handleBlur()\"\n (keyup.enter)=\"handleSearch($event)\"\n />\n <span\n matSuffix\n *ngIf=\"\n appearance === 'fill' ||\n appearance === 'outline' ||\n appearance === 'standard'\n \"\n >\n <ng-template [ngTemplateOutlet]=\"clearButton\"></ng-template>\n </span>\n </mat-form-field>\n <ng-template\n *ngIf=\"!appearance || appearance === 'legacy'\"\n [ngTemplateOutlet]=\"clearButton\"\n ></ng-template>\n</div>\n<ng-template #clearButton>\n <button\n mat-icon-button\n class=\"td-search-input-clear\"\n type=\"button\"\n [@searchState]=\"\n searchElement.value ? 'show' : isRTL ? 'hide-left' : 'hide-right'\n \"\n (click)=\"clearSearch()\"\n >\n <mat-icon>{{ clearIcon }}</mat-icon>\n </button>\n</ng-template>\n","import {\n Component,\n ViewChild,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n forwardRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n trigger,\n state,\n style,\n transition,\n animate,\n AUTO_STYLE,\n} from '@angular/animations';\n\nimport { TdSearchInputComponent } from '../search-input/search-input.component';\nimport { noop } from 'rxjs';\n\nexport class TdSearchBoxBase {\n constructor(public _changeDetectorRef: ChangeDetectorRef) {}\n}\n\n@Component({\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdSearchBoxComponent),\n multi: true,\n },\n ],\n selector: 'td-search-box',\n templateUrl: './search-box.component.html',\n styleUrls: ['./search-box.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('inputState', [\n state(\n '0',\n style({\n width: '0%',\n margin: '0px',\n })\n ),\n state(\n '1',\n style({\n width: '100%',\n margin: AUTO_STYLE,\n })\n ),\n transition('0 => 1', animate('200ms ease-in')),\n transition('1 => 0', animate('200ms ease-out')),\n ]),\n ],\n})\nexport class TdSearchBoxComponent implements ControlValueAccessor {\n private _searchVisible = false;\n @ViewChild(TdSearchInputComponent, { static: true })\n _searchInput?: TdSearchInputComponent;\n\n get searchVisible(): boolean {\n return this._searchVisible;\n }\n\n /**\n * backIcon?: string\n * The icon used to close the search toggle, only shown when [alwaysVisible] is false.\n * Defaults to 'search' icon.\n */\n @Input() backIcon = 'search';\n\n /**\n * searchIcon?: string\n * The icon used to open/focus the search toggle.\n * Defaults to 'search' icon.\n */\n @Input() searchIcon = 'search';\n\n /**\n * clearIcon?: string\n * The icon used to clear the search input.\n * Defaults to 'cancel' icon.\n */\n @Input() clearIcon = 'cancel';\n\n /**\n * showUnderline?: boolean\n * Sets if the input underline should be visible. Defaults to 'false'.\n */\n @Input() showUnderline = false;\n\n /**\n * debounce?: number\n * Debounce timeout between keypresses. Defaults to 400.\n */\n @Input() debounce = 400;\n\n /**\n * alwaysVisible?: boolean\n * Sets if the input should always be visible. Defaults to 'false'.\n */\n @Input() alwaysVisible = false;\n\n /**\n * placeholder?: string\n * Placeholder for the underlying input component.\n */\n @Input() placeholder = '';\n\n @Input() value: unknown;\n\n /**\n * searchDebounce: function($event)\n * Event emitted after the [debounce] timeout.\n */\n @Output() searchDebounce: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * search: function($event)\n * Event emitted after the key enter has been pressed.\n */\n @Output() search: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * clear: function()\n * Event emitted after the clear icon has been clicked.\n */\n @Output() clear: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * blur: function()\n * Event emitted after the blur event has been called in underlying input.\n */\n @Output() blurSearch: EventEmitter<void> = new EventEmitter<void>();\n\n constructor(private _changeDetectorRef: ChangeDetectorRef) {}\n\n writeValue(value: unknown): void {\n this.value = value;\n this._changeDetectorRef.markForCheck();\n }\n\n registerOnChange(): void {\n noop;\n }\n\n registerOnTouched(): void {\n noop;\n }\n\n /**\n * Method executed when the search icon is clicked.\n */\n searchClicked(): void {\n if (!this.alwaysVisible && this._searchVisible) {\n this.value = '';\n this.handleClear();\n } else if (this.alwaysVisible || !this._searchVisible) {\n this._searchInput?.focus();\n }\n this.toggleVisibility();\n }\n\n toggleVisibility(): void {\n this._searchVisible = !this._searchVisible;\n this._changeDetectorRef.markForCheck();\n }\n\n handleSearchDebounce(value: string): void {\n this.searchDebounce.emit(value);\n }\n\n handleSearch(value: string): void {\n this.search.emit(value);\n }\n\n handleClear(): void {\n this.clear.emit();\n }\n\n handleBlur(): void {\n this.blurSearch.emit();\n }\n}\n","<div class=\"td-search-box\">\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-search-icon\"\n (click)=\"searchClicked()\"\n >\n <mat-icon *ngIf=\"searchVisible && !alwaysVisible\">{{ backIcon }}</mat-icon>\n <mat-icon *ngIf=\"!searchVisible || alwaysVisible\">{{\n searchIcon\n }}</mat-icon>\n </button>\n <td-search-input\n #searchInput\n [@inputState]=\"alwaysVisible || searchVisible\"\n [debounce]=\"debounce\"\n [(ngModel)]=\"value\"\n [showUnderline]=\"showUnderline\"\n [placeholder]=\"placeholder\"\n [clearIcon]=\"clearIcon\"\n (searchDebounce)=\"handleSearchDebounce($event)\"\n (search)=\"handleSearch($event)\"\n (clear)=\"handleClear(); toggleVisibility()\"\n (blur)=\"handleBlur()\"\n ></td-search-input>\n</div>\n","import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\n\nimport { TdSearchInputComponent } from './search-input/search-input.component';\nimport { TdSearchBoxComponent } from './search-box/search-box.component';\n\n@NgModule({\n imports: [\n FormsModule,\n CommonModule,\n MatInputModule,\n MatIconModule,\n MatButtonModule,\n ],\n declarations: [TdSearchInputComponent, TdSearchBoxComponent],\n exports: [TdSearchInputComponent, TdSearchBoxComponent],\n})\nexport class CovalentSearchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;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AAK;gBAMI,cAAc;sBAAvB,MAAM;gBAMG,MAAM;sBAAf,MAAM;gBAMG,KAAK;sBAAd,MAAM;gBAMG,UAAU;sBAAnB,MAAM;;;MEnHI,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAHhB,sBAAsB,EAAE,oBAAoB,aANzD,WAAW;QACX,YAAY;QACZ,cAAc;QACd,aAAa;QACb,eAAe,aAGP,sBAAsB,EAAE,oBAAoB;kHAE3C,oBAAoB,YAVtB;YACP,WAAW;YACX,YAAY;YACZ,cAAc;YACd,aAAa;YACb,eAAe;SAChB;2FAIU,oBAAoB;kBAXhC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,WAAW;wBACX,YAAY;wBACZ,cAAc;wBACd,aAAa;wBACb,eAAe;qBAChB;oBACD,YAAY,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;oBAC5D,OAAO,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;iBACxD;;;ACtBD;;;;;;"}
1
+ {"version":3,"file":"covalent-core-search.mjs","sources":["../../../../libs/angular/search/src/search-input/search-input.component.ts","../../../../libs/angular/search/src/search-input/search-input.component.html","../../../../libs/angular/search/src/search-box/search-box.component.ts","../../../../libs/angular/search/src/search-box/search-box.component.html","../../../../libs/angular/search/src/search.module.ts","../../../../libs/angular/search/src/covalent-core-search.ts"],"sourcesContent":["import {\n Component,\n ViewChild,\n OnInit,\n Input,\n Output,\n EventEmitter,\n Optional,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n forwardRef,\n OnDestroy,\n ElementRef,\n NgZone,\n} from '@angular/core';\nimport {\n trigger,\n state,\n style,\n transition,\n animate,\n} from '@angular/animations';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Dir } from '@angular/cdk/bidi';\nimport { MatInput } from '@angular/material/input';\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\nimport { fromEvent, Subject } from 'rxjs';\nimport { debounceTime, skip, takeUntil } from 'rxjs/operators';\nimport {\n IControlValueAccessor,\n mixinControlValueAccessor,\n} from '@covalent/core/common';\n\nexport class TdSearchInputBase {\n constructor(public _changeDetectorRef: ChangeDetectorRef) {}\n}\n\nexport const _TdSearchInputMixinBase =\n mixinControlValueAccessor(TdSearchInputBase);\n\n@Component({\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdSearchInputComponent),\n multi: true,\n },\n ],\n selector: 'td-search-input',\n templateUrl: './search-input.component.html',\n styleUrls: ['./search-input.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('searchState', [\n state(\n 'hide-left',\n style({\n transform: 'translateX(-150%)',\n display: 'none',\n })\n ),\n state(\n 'hide-right',\n style({\n transform: 'translateX(150%)',\n display: 'none',\n })\n ),\n state(\n 'show',\n style({\n transform: 'translateX(0%)',\n display: 'block',\n })\n ),\n transition('* => show', animate('200ms ease-in')),\n transition('show => *', animate('200ms ease-out')),\n ]),\n ],\n})\nexport class TdSearchInputComponent\n extends _TdSearchInputMixinBase\n implements IControlValueAccessor, OnInit, OnDestroy\n{\n @ViewChild(MatInput, { static: true }) _input?: MatInput;\n\n @ViewChild('searchElement', { static: true, read: ElementRef })\n _searchElement!: ElementRef<HTMLInputElement>;\n\n /**\n * appearance?: MatFormFieldAppearance\n * Appearance style for the underlying input component.\n */\n @Input() appearance: MatFormFieldAppearance = 'legacy';\n\n /**\n * showUnderline?: boolean\n * Sets if the input underline should be visible. Defaults to 'false'.\n */\n @Input() showUnderline = false;\n\n /**\n * debounce?: number\n * Debounce timeout between keypresses. Defaults to 400.\n */\n @Input() debounce = 400;\n\n /**\n * placeholder?: string\n * Placeholder for the underlying input component.\n */\n @Input() placeholder = '';\n\n /**\n * clearIcon?: string\n * The icon used to clear the search input.\n * Defaults to 'cancel' icon.\n */\n @Input() clearIcon = 'cancel';\n\n @Input() override value!: unknown;\n\n /**\n * searchDebounce: function($event)\n * Event emitted after the [debounce] timeout.\n */\n @Output() searchDebounce: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * search: function($event)\n * Event emitted after the key enter has been pressed.\n */\n @Output() search: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * clear: function()\n * Event emitted after the clear icon has been clicked.\n */\n @Output() clear: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * blur: function()\n * Event emitted after the blur event has been called in underlying input.\n */\n @Output() blurSearch: EventEmitter<void> = new EventEmitter<void>();\n\n get isRTL(): boolean {\n if (this._dir) {\n return this._dir.dir === 'rtl';\n }\n return false;\n }\n\n private _destroy$ = new Subject<void>();\n\n constructor(\n @Optional() private _dir: Dir,\n override _changeDetectorRef: ChangeDetectorRef,\n private _ngZone: NgZone\n ) {\n super(_changeDetectorRef);\n }\n\n ngOnInit(): void {\n this._input?.ngControl?.valueChanges\n ?.pipe(\n debounceTime(this.debounce),\n skip(1), // skip first change when value is set to undefined\n takeUntil(this._destroy$)\n )\n .subscribe((value: string) => {\n this._searchTermChanged(value);\n });\n\n this._ngZone.runOutsideAngular(() =>\n fromEvent(this._searchElement.nativeElement, 'search')\n .pipe(takeUntil(this._destroy$))\n .subscribe(this._stopPropagation)\n );\n }\n\n ngOnDestroy(): void {\n this._destroy$.next();\n }\n\n /**\n * Method to focus to underlying input.\n */\n focus(): void {\n this._input?.focus();\n }\n\n handleBlur(): void {\n this.blurSearch.emit();\n }\n\n handleSearch(event: Event): void {\n this._stopPropagation(event);\n if (typeof this.value == 'string') {\n this.search.emit(this.value);\n }\n }\n\n /**\n * Method to clear the underlying input.\n */\n clearSearch(): void {\n this.value = '';\n this._changeDetectorRef.markForCheck();\n this.clear.emit();\n }\n\n private _searchTermChanged(value: string): void {\n this.searchDebounce.emit(value);\n }\n\n private _stopPropagation(event: Event): void {\n event.stopPropagation();\n }\n}\n","<div class=\"td-search-input\">\n <mat-form-field\n class=\"td-search-input-field\"\n [class.mat-hide-underline]=\"!showUnderline\"\n [appearance]=\"appearance\"\n floatLabel=\"never\"\n >\n <input\n matInput\n #searchElement\n type=\"search\"\n [(ngModel)]=\"value\"\n [placeholder]=\"placeholder\"\n (blur)=\"handleBlur()\"\n (keyup.enter)=\"handleSearch($event)\"\n />\n <span\n matSuffix\n *ngIf=\"\n appearance === 'fill' ||\n appearance === 'outline' ||\n appearance === 'standard'\n \"\n >\n <ng-template [ngTemplateOutlet]=\"clearButton\"></ng-template>\n </span>\n </mat-form-field>\n <ng-template\n *ngIf=\"!appearance || appearance === 'legacy'\"\n [ngTemplateOutlet]=\"clearButton\"\n ></ng-template>\n</div>\n<ng-template #clearButton>\n <button\n mat-icon-button\n class=\"td-search-input-clear\"\n type=\"button\"\n [@searchState]=\"\n searchElement.value ? 'show' : isRTL ? 'hide-left' : 'hide-right'\n \"\n (click)=\"clearSearch()\"\n >\n <mat-icon>{{ clearIcon }}</mat-icon>\n </button>\n</ng-template>\n","import {\n Component,\n ViewChild,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n forwardRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n trigger,\n state,\n style,\n transition,\n animate,\n AUTO_STYLE,\n} from '@angular/animations';\n\nimport { TdSearchInputComponent } from '../search-input/search-input.component';\nimport { noop } from 'rxjs';\n\nexport class TdSearchBoxBase {\n constructor(public _changeDetectorRef: ChangeDetectorRef) {}\n}\n\n@Component({\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TdSearchBoxComponent),\n multi: true,\n },\n ],\n selector: 'td-search-box',\n templateUrl: './search-box.component.html',\n styleUrls: ['./search-box.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n animations: [\n trigger('inputState', [\n state(\n '0',\n style({\n width: '0%',\n margin: '0px',\n })\n ),\n state(\n '1',\n style({\n width: '100%',\n margin: AUTO_STYLE,\n })\n ),\n transition('0 => 1', animate('200ms ease-in')),\n transition('1 => 0', animate('200ms ease-out')),\n ]),\n ],\n})\nexport class TdSearchBoxComponent implements ControlValueAccessor {\n private _searchVisible = false;\n @ViewChild(TdSearchInputComponent, { static: true })\n _searchInput?: TdSearchInputComponent;\n\n get searchVisible(): boolean {\n return this._searchVisible;\n }\n\n /**\n * backIcon?: string\n * The icon used to close the search toggle, only shown when [alwaysVisible] is false.\n * Defaults to 'search' icon.\n */\n @Input() backIcon = 'search';\n\n /**\n * searchIcon?: string\n * The icon used to open/focus the search toggle.\n * Defaults to 'search' icon.\n */\n @Input() searchIcon = 'search';\n\n /**\n * clearIcon?: string\n * The icon used to clear the search input.\n * Defaults to 'cancel' icon.\n */\n @Input() clearIcon = 'cancel';\n\n /**\n * showUnderline?: boolean\n * Sets if the input underline should be visible. Defaults to 'false'.\n */\n @Input() showUnderline = false;\n\n /**\n * debounce?: number\n * Debounce timeout between keypresses. Defaults to 400.\n */\n @Input() debounce = 400;\n\n /**\n * alwaysVisible?: boolean\n * Sets if the input should always be visible. Defaults to 'false'.\n */\n @Input() alwaysVisible = false;\n\n /**\n * placeholder?: string\n * Placeholder for the underlying input component.\n */\n @Input() placeholder = '';\n\n @Input() value: unknown;\n\n /**\n * searchDebounce: function($event)\n * Event emitted after the [debounce] timeout.\n */\n @Output() searchDebounce: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * search: function($event)\n * Event emitted after the key enter has been pressed.\n */\n @Output() search: EventEmitter<string> = new EventEmitter<string>();\n\n /**\n * clear: function()\n * Event emitted after the clear icon has been clicked.\n */\n @Output() clear: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * blur: function()\n * Event emitted after the blur event has been called in underlying input.\n */\n @Output() blurSearch: EventEmitter<void> = new EventEmitter<void>();\n\n constructor(private _changeDetectorRef: ChangeDetectorRef) {}\n\n writeValue(value: unknown): void {\n this.value = value;\n this._changeDetectorRef.markForCheck();\n }\n\n registerOnChange(): void {\n noop;\n }\n\n registerOnTouched(): void {\n noop;\n }\n\n /**\n * Method executed when the search icon is clicked.\n */\n searchClicked(): void {\n if (!this.alwaysVisible && this._searchVisible) {\n this.value = '';\n this.handleClear();\n } else if (this.alwaysVisible || !this._searchVisible) {\n this._searchInput?.focus();\n }\n this.toggleVisibility();\n }\n\n toggleVisibility(): void {\n this._searchVisible = !this._searchVisible;\n this._changeDetectorRef.markForCheck();\n }\n\n handleSearchDebounce(value: string): void {\n this.searchDebounce.emit(value);\n }\n\n handleSearch(value: string): void {\n this.search.emit(value);\n }\n\n handleClear(): void {\n this.clear.emit();\n }\n\n handleBlur(): void {\n this.blurSearch.emit();\n }\n}\n","<div class=\"td-search-box\">\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-search-icon\"\n (click)=\"searchClicked()\"\n >\n <mat-icon *ngIf=\"searchVisible && !alwaysVisible\">{{ backIcon }}</mat-icon>\n <mat-icon *ngIf=\"!searchVisible || alwaysVisible\">{{\n searchIcon\n }}</mat-icon>\n </button>\n <td-search-input\n #searchInput\n [@inputState]=\"alwaysVisible || searchVisible\"\n [debounce]=\"debounce\"\n [(ngModel)]=\"value\"\n [showUnderline]=\"showUnderline\"\n [placeholder]=\"placeholder\"\n [clearIcon]=\"clearIcon\"\n (searchDebounce)=\"handleSearchDebounce($event)\"\n (search)=\"handleSearch($event)\"\n (clear)=\"handleClear(); toggleVisibility()\"\n (blur)=\"handleBlur()\"\n ></td-search-input>\n</div>\n","import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\n\nimport { TdSearchInputComponent } from './search-input/search-input.component';\nimport { TdSearchBoxComponent } from './search-box/search-box.component';\n\n@NgModule({\n imports: [\n FormsModule,\n CommonModule,\n MatInputModule,\n MatIconModule,\n MatButtonModule,\n ],\n declarations: [TdSearchInputComponent, TdSearchBoxComponent],\n exports: [TdSearchInputComponent, TdSearchBoxComponent],\n})\nexport class CovalentSearchModule {}\n","/**\n * Generated bundle index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;gBAMG,MAAM;sBAAf,MAAM;gBAMG,KAAK;sBAAd,MAAM;gBAMG,UAAU;sBAAnB,MAAM;;;MEnHI,oBAAoB;;iHAApB,oBAAoB;kHAApB,oBAAoB,iBAHhB,sBAAsB,EAAE,oBAAoB,aANzD,WAAW;QACX,YAAY;QACZ,cAAc;QACd,aAAa;QACb,eAAe,aAGP,sBAAsB,EAAE,oBAAoB;kHAE3C,oBAAoB,YAVtB;YACP,WAAW;YACX,YAAY;YACZ,cAAc;YACd,aAAa;YACb,eAAe;SAChB;2FAIU,oBAAoB;kBAXhC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,WAAW;wBACX,YAAY;wBACZ,cAAc;wBACd,aAAa;wBACb,eAAe;qBAChB;oBACD,YAAY,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;oBAC5D,OAAO,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;iBACxD;;;ACtBD;;;;;;"}
@@ -434,7 +434,7 @@ class TdTruncatePipe {
434
434
  return '';
435
435
  }
436
436
  // Truncate
437
- let truncated = text.substr(0, length);
437
+ let truncated = text.substring(0, length);
438
438
  if (text.length > length) {
439
439
  if (truncated.lastIndexOf(' ') > 0) {
440
440
  truncated = truncated.trim();