@colijnit/corecomponents_v12 256.1.15 → 256.1.17

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.
@@ -5691,9 +5691,10 @@ OverlayModule.decorators = [
5691
5691
  ];
5692
5692
 
5693
5693
  class InputTextComponent extends BaseInputComponent {
5694
- constructor(formComponent, changeDetector, overlayService, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
5694
+ constructor(formComponent, injector, changeDetector, overlayService, componentFactoryResolver, formUserChangeListener, ngZoneWrapper, elementRef) {
5695
5695
  super(changeDetector, componentFactoryResolver, overlayService, formUserChangeListener, ngZoneWrapper, elementRef);
5696
5696
  this.formComponent = formComponent;
5697
+ this.injector = injector;
5697
5698
  this.changeDetector = changeDetector;
5698
5699
  this.overlayService = overlayService;
5699
5700
  this.componentFactoryResolver = componentFactoryResolver;
@@ -5763,6 +5764,17 @@ class InputTextComponent extends BaseInputComponent {
5763
5764
  get model() {
5764
5765
  return super.model;
5765
5766
  }
5767
+ get pipedModel() {
5768
+ if (this.formatPipe) {
5769
+ try {
5770
+ const pipe = new this.formatPipe(this);
5771
+ return pipe.transform(this.model);
5772
+ }
5773
+ catch (e) {
5774
+ }
5775
+ }
5776
+ return this.model;
5777
+ }
5766
5778
  // exclude some non-digit characters, since input type 'number' still allows the characters -, + and e
5767
5779
  excludeNonDigitChars(event) {
5768
5780
  const excludedKeys = this.excludePlusMinus ? ['e', '-', '+'] : ['e'];
@@ -5838,7 +5850,13 @@ InputTextComponent.decorators = [
5838
5850
  <div class="input-wrapper">
5839
5851
  <label *ngIf="showPlaceholderOnFocus || (!showPlaceholderOnFocus && !hasValue && !focused)"
5840
5852
  [textContent]="placeholder"></label>
5841
- <input #input
5853
+ <span class="input-text-formatted" *ngIf="!focused && !useContent && formatPipe"
5854
+ [class.show]="!focused && !useContent && formatPipe"
5855
+ [ngClass]="align"
5856
+ [textContent]="pipedModel"
5857
+ (click)="doFocus($event)"
5858
+ ></span>
5859
+ <input [class.show]="focused || !formatPipe" #input
5842
5860
  [class.input-input-hidden]="useContent"
5843
5861
  [ngClass]="align"
5844
5862
  [type]="(isFocusedOnDate || (hasValue && emptyPlace)) ? 'date' : (digitsOnly ? 'number' : (type === 'date' ? 'text' : type))"
@@ -5894,6 +5912,7 @@ InputTextComponent.decorators = [
5894
5912
  ];
5895
5913
  InputTextComponent.ctorParameters = () => [
5896
5914
  { type: FormComponent, decorators: [{ type: Optional }] },
5915
+ { type: Injector },
5897
5916
  { type: ChangeDetectorRef },
5898
5917
  { type: OverlayService },
5899
5918
  { type: ComponentFactoryResolver },
@@ -5906,6 +5925,7 @@ InputTextComponent.propDecorators = {
5906
5925
  placeholder: [{ type: Input }],
5907
5926
  align: [{ type: Input }],
5908
5927
  type: [{ type: Input }],
5928
+ formatPipe: [{ type: Input }],
5909
5929
  min: [{ type: Input }],
5910
5930
  max: [{ type: Input }],
5911
5931
  pattern: [{ type: Input }],
@@ -11935,6 +11955,7 @@ class FilterItemComponent {
11935
11955
  this.limitTo = 10;
11936
11956
  this.filterText = "";
11937
11957
  this.showButton = false;
11958
+ this.isLoading = false;
11938
11959
  this._collection = [];
11939
11960
  this._mode = this.modes.Filterlist;
11940
11961
  }
@@ -12057,20 +12078,31 @@ class FilterItemComponent {
12057
12078
  }
12058
12079
  return false;
12059
12080
  }
12081
+ onModelChange(text) {
12082
+ this.isLoading = true;
12083
+ clearTimeout(this.debounceTimeout);
12084
+ this.debounceTimeout = setTimeout(() => {
12085
+ this.applyFilter(text);
12086
+ }, 300);
12087
+ }
12060
12088
  // Applies filter to the collection.
12061
12089
  applyFilter(text) {
12062
12090
  var _a, _b;
12063
12091
  return __awaiter(this, void 0, void 0, function* () {
12064
- if (!isNaN(this.minSearchCharsToLoadCollection) && this.collectionLoadFn) {
12065
- if (text.length === this.minSearchCharsToLoadCollection && text.length > this.filterText.length) {
12066
- this.collection = yield this.collectionLoadFn(text);
12067
- }
12068
- else if (text.length < this.minSearchCharsToLoadCollection) {
12092
+ if (!isNaN(this.minSearchCharsToLoadCollection)) {
12093
+ if (text.length < this.minSearchCharsToLoadCollection) {
12094
+ yield new Promise(resolve => setTimeout(resolve, 300));
12069
12095
  this.collection = undefined;
12070
12096
  }
12097
+ else {
12098
+ yield new Promise(resolve => setTimeout(resolve, 300));
12099
+ this.collection = yield this.collectionLoadFn(text);
12100
+ }
12071
12101
  }
12072
12102
  this.filterText = text;
12073
12103
  if (!this.collection) {
12104
+ this._changeDetector.detectChanges();
12105
+ this.isLoading = false;
12074
12106
  return [];
12075
12107
  }
12076
12108
  const filterText = (_a = this.filterText) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase();
@@ -12087,6 +12119,8 @@ class FilterItemComponent {
12087
12119
  return true;
12088
12120
  }
12089
12121
  });
12122
+ this.isLoading = false;
12123
+ this._changeDetector.detectChanges();
12090
12124
  });
12091
12125
  }
12092
12126
  onButtonClicked() {
@@ -12393,14 +12427,15 @@ FilterItemComponent.decorators = [
12393
12427
  <ng-template #collectionContent>
12394
12428
  <div class="co-filter-item-collection-content" *ngIf="mode === modes.Filterlist || mode === modes.SingleSelectList
12395
12429
  || mode === modes.SelectListWithNumberOutput || mode === modes.SelectListWithStringCollectionOutput">
12396
- <co-input-text
12397
- *ngIf="collection?.length > 10 || minSearchCharsToLoadCollection"
12398
- [placeholder]="searchPlaceholder"
12399
- [model]="filterText"
12400
- (modelChange)="applyFilter($event)"
12401
- [readonly]="readonly"
12402
- >
12403
- </co-input-text>
12430
+ <co-input-text
12431
+ *ngIf="collection?.length > 10 || minSearchCharsToLoadCollection"
12432
+ [placeholder]="searchPlaceholder"
12433
+ [model]="filterText"
12434
+ (modelChange)="onModelChange($event)"
12435
+ [readonly]="readonly"
12436
+ >
12437
+ </co-input-text>
12438
+ <div *ngIf="isLoading" class="filter-loader"><span></span></div>
12404
12439
  <div class="no-results" *ngIf="filteredCollection?.length === 0">
12405
12440
  <span [textContent]="noResultsLabel"></span>
12406
12441
  </div>