@colijnit/corecomponents_v12 257.1.22 → 257.1.24

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.
@@ -6555,9 +6555,14 @@ class CalendarTemplateComponent {
6555
6555
  }
6556
6556
  selectDate(day) {
6557
6557
  if (day) {
6558
- this.selectedDate = day;
6559
- this._fillDatesBetweenSelected();
6560
- if (this.doubleCalendar) {
6558
+ if (!this.doubleCalendar) {
6559
+ // Single calendar → select and close
6560
+ this.selectedDate = day;
6561
+ this.setAndClose();
6562
+ }
6563
+ else {
6564
+ this.selectedDate = day;
6565
+ this._fillDatesBetweenSelected();
6561
6566
  this.dateSelected.emit(new Date(this.selectedDate));
6562
6567
  }
6563
6568
  }
@@ -6757,8 +6762,8 @@ CalendarTemplateComponent.decorators = [
6757
6762
  </div>
6758
6763
  </div>
6759
6764
  <div class="calendar-action-buttons" *ngIf="showButtons">
6760
- <span class="set-and-close-button" (click)="setAndClose()">Instellen</span>
6761
- <span class="clear-date-button" (click)="clearDate()">Wissen</span>
6765
+ <span class="set-and-close-button" *ngIf="this.doubleCalendar" (click)="setAndClose()">Instellen</span>
6766
+ <span class="clear-date-button" *ngIf="this.selectedDate" (click)="clearDate()">Wissen</span>
6762
6767
  <span class="cancel-button" (click)="closeDate()">Annuleren</span>
6763
6768
  </div>
6764
6769
  </div>
@@ -11170,12 +11175,16 @@ class ListOfValuesComponent extends BaseInputComponent {
11170
11175
  super(...arguments);
11171
11176
  this.icons = CoreComponentsIcon;
11172
11177
  this.multiselect = false;
11178
+ this.largeCollection = false;
11173
11179
  this.displayField = 'description';
11174
11180
  this.searchDisabled = false;
11175
11181
  this.showChips = true;
11176
11182
  this.isSelectOpen = false;
11177
11183
  this.state = 'default';
11184
+ this.filterText = '';
11178
11185
  this.selectedModels = [];
11186
+ this.filteredCollection = [];
11187
+ this.isLoading = false;
11179
11188
  this._collection = [];
11180
11189
  }
11181
11190
  set model(value) {
@@ -11210,6 +11219,38 @@ class ListOfValuesComponent extends BaseInputComponent {
11210
11219
  }
11211
11220
  this.selectedModel = model;
11212
11221
  }
11222
+ onModelChange(text) {
11223
+ this.isLoading = true;
11224
+ clearTimeout(this.debounceTimeout);
11225
+ this.debounceTimeout = setTimeout(() => {
11226
+ this.applyFilter(text);
11227
+ }, 300);
11228
+ }
11229
+ applyFilter(text) {
11230
+ var _a, _b, _c;
11231
+ return __awaiter(this, void 0, void 0, function* () {
11232
+ if ((text === null || text === void 0 ? void 0 : text.length) < 3) {
11233
+ yield new Promise(resolve => setTimeout(resolve, 300));
11234
+ this.collection = undefined;
11235
+ }
11236
+ else {
11237
+ yield new Promise(resolve => setTimeout(resolve, 300));
11238
+ this.collection = yield this.collectionLoadFn(text);
11239
+ }
11240
+ this.filterText = text;
11241
+ if (!this.collection) {
11242
+ this.changeDetector.detectChanges();
11243
+ this.isLoading = false;
11244
+ return [];
11245
+ }
11246
+ this.filteredCollection = (_a = this.collection) === null || _a === void 0 ? void 0 : _a.filter(() => {
11247
+ return true;
11248
+ });
11249
+ (((_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();
11250
+ this.isLoading = false;
11251
+ this.changeDetector.detectChanges();
11252
+ });
11253
+ }
11213
11254
  handleInputKeyDown(event) {
11214
11255
  if (event) {
11215
11256
  if (event.altKey && event.code === KeyboardKey.Down && !this._lovPopupComponentRef) {
@@ -11284,6 +11325,9 @@ class ListOfValuesComponent extends BaseInputComponent {
11284
11325
  }
11285
11326
  else {
11286
11327
  this.selectedModel = option[this.displayField];
11328
+ if (this.largeCollection) {
11329
+ this.filterText = option[this.displayField];
11330
+ }
11287
11331
  }
11288
11332
  }
11289
11333
  this.model = option;
@@ -11324,6 +11368,9 @@ class ListOfValuesComponent extends BaseInputComponent {
11324
11368
  else {
11325
11369
  if (this.model) {
11326
11370
  this.selectedModel = this.model[this.displayField];
11371
+ if (this.largeCollection) {
11372
+ this.filterText = this.model[this.displayField];
11373
+ }
11327
11374
  }
11328
11375
  else {
11329
11376
  this.selectedModel = '';
@@ -11335,29 +11382,35 @@ ListOfValuesComponent.decorators = [
11335
11382
  { type: Component, args: [{
11336
11383
  selector: 'co-list-of-values',
11337
11384
  template: `
11338
- <co-input-text aria-haspopup="listbox" [attr.aria-expanded]="isSelectOpen" aria-controls="lov-popup" role="combobox"
11339
- class="no-focus-line"
11340
- overlayParent
11341
- #parentForOverlay="overlayParent" type="text" [id]="label"
11342
- [model]="multiselect ? selectedModels : selectedModel"
11343
- [placeholder]="label"
11344
- [readonly]="readonly"
11345
- [disabled]="disabled"
11346
- [required]="required"
11347
- [noClickFocus]="false"
11348
- [leftIconData]="leftIconData"
11349
- [rightIcon]="isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular"
11350
- [showClearButton]="true"
11351
- [useContent]="multiselect"
11352
- [customHeight]="multiselect"
11353
- [keepFocussed]="keepFocussed"
11354
- (modelChange)="handleInputModelChange($event)"
11355
- (click)="openPopup()"
11356
- (rightIconClick)="toggleSelect()"
11357
- (keydown)="handleInputKeyDown($event)"
11358
- (clearIconClick)="clearModel($event)"
11359
- (blur)="checkModel()"
11360
- >
11385
+ <co-input-text
11386
+ *ngIf="!largeCollection"
11387
+ aria-haspopup="listbox"
11388
+ [attr.aria-expanded]="isSelectOpen"
11389
+ aria-controls="lov-popup"
11390
+ role="combobox"
11391
+ class="no-focus-line"
11392
+ overlayParent
11393
+ #parentForOverlay="overlayParent"
11394
+ type="text"
11395
+ [id]="label"
11396
+ [model]="multiselect ? selectedModels : selectedModel"
11397
+ [placeholder]="label"
11398
+ [readonly]="readonly"
11399
+ [disabled]="disabled"
11400
+ [required]="required"
11401
+ [noClickFocus]="false"
11402
+ [leftIconData]="leftIconData"
11403
+ [rightIcon]="isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular"
11404
+ [showClearButton]="true"
11405
+ [useContent]="multiselect"
11406
+ [customHeight]="multiselect"
11407
+ [keepFocussed]="keepFocussed"
11408
+ (modelChange)="handleInputModelChange($event)"
11409
+ (click)="openPopup()"
11410
+ (rightIconClick)="toggleSelect()"
11411
+ (keydown)="handleInputKeyDown($event)"
11412
+ (clearIconClick)="clearModel($event)"
11413
+ (blur)="checkModel()">
11361
11414
  <ng-container *ngIf="multiselect && showChips">
11362
11415
  <div class="multiselect-chips-wrapper">
11363
11416
  <div class="chips" *ngFor="let chip of model">
@@ -11367,6 +11420,17 @@ ListOfValuesComponent.decorators = [
11367
11420
  </div>
11368
11421
  </ng-container>
11369
11422
  </co-input-text>
11423
+
11424
+ <co-input-text
11425
+ *ngIf="largeCollection"
11426
+ [model]="filterText"
11427
+ [placeholder]="label"
11428
+ [required]="required"
11429
+ [disabled]="disabled"
11430
+ [readonly]="readonly"
11431
+ (modelChange)="onModelChange($event)">
11432
+ </co-input-text>
11433
+ <div *ngIf="isLoading" class="filter-loader"><span></span></div>
11370
11434
  `,
11371
11435
  providers: [
11372
11436
  OverlayService,
@@ -11382,8 +11446,10 @@ ListOfValuesComponent.propDecorators = {
11382
11446
  model: [{ type: Input }],
11383
11447
  parentForOverlay: [{ type: ViewChild, args: ['parentForOverlay', { read: ElementRef },] }],
11384
11448
  multiselect: [{ type: HostBinding, args: ['class.custom-height',] }, { type: HostBinding, args: ['class.multi-select',] }, { type: Input }],
11449
+ largeCollection: [{ type: Input }],
11385
11450
  displayField: [{ type: Input }],
11386
11451
  collection: [{ type: Input }],
11452
+ collectionLoadFn: [{ type: Input }],
11387
11453
  leftIconData: [{ type: Input }],
11388
11454
  searchPlaceholder: [{ type: Input }],
11389
11455
  label: [{ type: Input }],