@colijnit/corecomponents_v12 258.1.0 → 258.1.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.
@@ -11687,12 +11687,16 @@
11687
11687
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
11688
11688
  _this.icons = exports.CoreComponentsIcon;
11689
11689
  _this.multiselect = false;
11690
+ _this.largeCollection = false;
11690
11691
  _this.displayField = 'description';
11691
11692
  _this.searchDisabled = false;
11692
11693
  _this.showChips = true;
11693
11694
  _this.isSelectOpen = false;
11694
11695
  _this.state = 'default';
11696
+ _this.filterText = '';
11695
11697
  _this.selectedModels = [];
11698
+ _this.filteredCollection = [];
11699
+ _this.isLoading = false;
11696
11700
  _this._collection = [];
11697
11701
  return _this;
11698
11702
  }
@@ -11736,6 +11740,53 @@
11736
11740
  }
11737
11741
  this.selectedModel = model;
11738
11742
  };
11743
+ ListOfValuesComponent.prototype.onModelChange = function (text) {
11744
+ var _this = this;
11745
+ this.isLoading = true;
11746
+ clearTimeout(this.debounceTimeout);
11747
+ this.debounceTimeout = setTimeout(function () {
11748
+ _this.applyFilter(text);
11749
+ }, 300);
11750
+ };
11751
+ ListOfValuesComponent.prototype.applyFilter = function (text) {
11752
+ var _a, _b, _c;
11753
+ return __awaiter(this, void 0, void 0, function () {
11754
+ var _d;
11755
+ return __generator(this, function (_e) {
11756
+ switch (_e.label) {
11757
+ case 0:
11758
+ if (!((text === null || text === void 0 ? void 0 : text.length) < 3)) return [3 /*break*/, 2];
11759
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 300); })];
11760
+ case 1:
11761
+ _e.sent();
11762
+ this.collection = undefined;
11763
+ return [3 /*break*/, 5];
11764
+ case 2: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 300); })];
11765
+ case 3:
11766
+ _e.sent();
11767
+ _d = this;
11768
+ return [4 /*yield*/, this.collectionLoadFn(text)];
11769
+ case 4:
11770
+ _d.collection = _e.sent();
11771
+ _e.label = 5;
11772
+ case 5:
11773
+ this.filterText = text;
11774
+ if (!this.collection) {
11775
+ this.changeDetector.detectChanges();
11776
+ this.isLoading = false;
11777
+ return [2 /*return*/, []];
11778
+ }
11779
+ this.filteredCollection = (_a = this.collection) === null || _a === void 0 ? void 0 : _a.filter(function () {
11780
+ return true;
11781
+ });
11782
+ (((_b = this.filteredCollection) === null || _b === void 0 ? void 0 : _b.length) > 0 && ((_c = this.filterText) === null || _c === void 0 ? void 0 : _c.length) > 2) ? this.openPopup() : this.closePopup();
11783
+ this.isLoading = false;
11784
+ this.changeDetector.detectChanges();
11785
+ return [2 /*return*/];
11786
+ }
11787
+ });
11788
+ });
11789
+ };
11739
11790
  ListOfValuesComponent.prototype.handleInputKeyDown = function (event) {
11740
11791
  if (event) {
11741
11792
  if (event.altKey && event.code === KeyboardKey.Down && !this._lovPopupComponentRef) {
@@ -11812,6 +11863,9 @@
11812
11863
  }
11813
11864
  else {
11814
11865
  this.selectedModel = option[this.displayField];
11866
+ if (this.largeCollection) {
11867
+ this.filterText = option[this.displayField];
11868
+ }
11815
11869
  }
11816
11870
  }
11817
11871
  this.model = option;
@@ -11854,6 +11908,9 @@
11854
11908
  else {
11855
11909
  if (this.model) {
11856
11910
  this.selectedModel = this.model[this.displayField];
11911
+ if (this.largeCollection) {
11912
+ this.filterText = this.model[this.displayField];
11913
+ }
11857
11914
  }
11858
11915
  else {
11859
11916
  this.selectedModel = '';
@@ -11865,7 +11922,7 @@
11865
11922
  ListOfValuesComponent.decorators = [
11866
11923
  { type: i0.Component, args: [{
11867
11924
  selector: 'co-list-of-values',
11868
- template: "\n <co-input-text aria-haspopup=\"listbox\" [attr.aria-expanded]=\"isSelectOpen\" aria-controls=\"lov-popup\" role=\"combobox\"\n class=\"no-focus-line\"\n overlayParent\n #parentForOverlay=\"overlayParent\" type=\"text\" [id]=\"label\"\n [model]=\"multiselect ? selectedModels : selectedModel\"\n [placeholder]=\"label\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [noClickFocus]=\"false\"\n [leftIconData]=\"leftIconData\"\n [rightIcon]=\"isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular\"\n [showClearButton]=\"true\"\n [useContent]=\"multiselect\"\n [customHeight]=\"multiselect\"\n [keepFocussed]=\"keepFocussed\"\n (modelChange)=\"handleInputModelChange($event)\"\n (click)=\"openPopup()\"\n (rightIconClick)=\"toggleSelect()\"\n (keydown)=\"handleInputKeyDown($event)\"\n (clearIconClick)=\"clearModel($event)\"\n (blur)=\"checkModel()\"\n >\n <ng-container *ngIf=\"multiselect && showChips\">\n <div class=\"multiselect-chips-wrapper\">\n <div class=\"chips\" *ngFor=\"let chip of model\">\n <span class=\"chips-description\" [textContent]=\"chip[displayField]\"></span>\n <co-icon class=\"remove-chip-icon\" [icon]=\"icons.CrossSkinny\" (click)=\"removeOptionFromModel(chip)\"></co-icon>\n </div>\n </div>\n </ng-container>\n </co-input-text>\n ",
11925
+ template: "\n <co-input-text\n *ngIf=\"!largeCollection\"\n aria-haspopup=\"listbox\"\n [attr.aria-expanded]=\"isSelectOpen\"\n aria-controls=\"lov-popup\"\n role=\"combobox\"\n class=\"no-focus-line\"\n overlayParent\n #parentForOverlay=\"overlayParent\"\n type=\"text\"\n [id]=\"label\"\n [model]=\"multiselect ? selectedModels : selectedModel\"\n [placeholder]=\"label\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [noClickFocus]=\"false\"\n [leftIconData]=\"leftIconData\"\n [rightIcon]=\"isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular\"\n [showClearButton]=\"true\"\n [useContent]=\"multiselect\"\n [customHeight]=\"multiselect\"\n [keepFocussed]=\"keepFocussed\"\n (modelChange)=\"handleInputModelChange($event)\"\n (click)=\"openPopup()\"\n (rightIconClick)=\"toggleSelect()\"\n (keydown)=\"handleInputKeyDown($event)\"\n (clearIconClick)=\"clearModel($event)\"\n (blur)=\"checkModel()\">\n <ng-container *ngIf=\"multiselect && showChips\">\n <div class=\"multiselect-chips-wrapper\">\n <div class=\"chips\" *ngFor=\"let chip of model\">\n <span class=\"chips-description\" [textContent]=\"chip[displayField]\"></span>\n <co-icon class=\"remove-chip-icon\" [icon]=\"icons.CrossSkinny\" (click)=\"removeOptionFromModel(chip)\"></co-icon>\n </div>\n </div>\n </ng-container>\n </co-input-text>\n \n <co-input-text\n *ngIf=\"largeCollection\"\n [model]=\"filterText\"\n [placeholder]=\"label\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n (modelChange)=\"onModelChange($event)\">\n </co-input-text>\n <div *ngIf=\"isLoading\" class=\"filter-loader\"><span></span></div>\n ",
11869
11926
  providers: [
11870
11927
  OverlayService,
11871
11928
  {
@@ -11880,8 +11937,10 @@
11880
11937
  model: [{ type: i0.Input }],
11881
11938
  parentForOverlay: [{ type: i0.ViewChild, args: ['parentForOverlay', { read: i0.ElementRef },] }],
11882
11939
  multiselect: [{ type: i0.HostBinding, args: ['class.custom-height',] }, { type: i0.HostBinding, args: ['class.multi-select',] }, { type: i0.Input }],
11940
+ largeCollection: [{ type: i0.Input }],
11883
11941
  displayField: [{ type: i0.Input }],
11884
11942
  collection: [{ type: i0.Input }],
11943
+ collectionLoadFn: [{ type: i0.Input }],
11885
11944
  leftIconData: [{ type: i0.Input }],
11886
11945
  searchPlaceholder: [{ type: i0.Input }],
11887
11946
  label: [{ type: i0.Input }],