@colijnit/corecomponents_v12 258.1.0 → 258.1.2

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.
@@ -11170,12 +11170,16 @@ class ListOfValuesComponent extends BaseInputComponent {
11170
11170
  super(...arguments);
11171
11171
  this.icons = CoreComponentsIcon;
11172
11172
  this.multiselect = false;
11173
+ this.largeCollection = false;
11173
11174
  this.displayField = 'description';
11174
11175
  this.searchDisabled = false;
11175
11176
  this.showChips = true;
11176
11177
  this.isSelectOpen = false;
11177
11178
  this.state = 'default';
11179
+ this.filterText = '';
11178
11180
  this.selectedModels = [];
11181
+ this.filteredCollection = [];
11182
+ this.isLoading = false;
11179
11183
  this._collection = [];
11180
11184
  }
11181
11185
  set model(value) {
@@ -11210,6 +11214,38 @@ class ListOfValuesComponent extends BaseInputComponent {
11210
11214
  }
11211
11215
  this.selectedModel = model;
11212
11216
  }
11217
+ onModelChange(text) {
11218
+ this.isLoading = true;
11219
+ clearTimeout(this.debounceTimeout);
11220
+ this.debounceTimeout = setTimeout(() => {
11221
+ this.applyFilter(text);
11222
+ }, 300);
11223
+ }
11224
+ applyFilter(text) {
11225
+ var _a, _b, _c;
11226
+ return __awaiter(this, void 0, void 0, function* () {
11227
+ if ((text === null || text === void 0 ? void 0 : text.length) < 3) {
11228
+ yield new Promise(resolve => setTimeout(resolve, 300));
11229
+ this.collection = undefined;
11230
+ }
11231
+ else {
11232
+ yield new Promise(resolve => setTimeout(resolve, 300));
11233
+ this.collection = yield this.collectionLoadFn(text);
11234
+ }
11235
+ this.filterText = text;
11236
+ if (!this.collection) {
11237
+ this.changeDetector.detectChanges();
11238
+ this.isLoading = false;
11239
+ return [];
11240
+ }
11241
+ this.filteredCollection = (_a = this.collection) === null || _a === void 0 ? void 0 : _a.filter(() => {
11242
+ return true;
11243
+ });
11244
+ (((_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();
11245
+ this.isLoading = false;
11246
+ this.changeDetector.detectChanges();
11247
+ });
11248
+ }
11213
11249
  handleInputKeyDown(event) {
11214
11250
  if (event) {
11215
11251
  if (event.altKey && event.code === KeyboardKey.Down && !this._lovPopupComponentRef) {
@@ -11284,6 +11320,9 @@ class ListOfValuesComponent extends BaseInputComponent {
11284
11320
  }
11285
11321
  else {
11286
11322
  this.selectedModel = option[this.displayField];
11323
+ if (this.largeCollection) {
11324
+ this.filterText = option[this.displayField];
11325
+ }
11287
11326
  }
11288
11327
  }
11289
11328
  this.model = option;
@@ -11324,6 +11363,9 @@ class ListOfValuesComponent extends BaseInputComponent {
11324
11363
  else {
11325
11364
  if (this.model) {
11326
11365
  this.selectedModel = this.model[this.displayField];
11366
+ if (this.largeCollection) {
11367
+ this.filterText = this.model[this.displayField];
11368
+ }
11327
11369
  }
11328
11370
  else {
11329
11371
  this.selectedModel = '';
@@ -11335,39 +11377,56 @@ ListOfValuesComponent.decorators = [
11335
11377
  { type: Component, args: [{
11336
11378
  selector: 'co-list-of-values',
11337
11379
  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
- >
11361
- <ng-container *ngIf="multiselect && showChips">
11362
- <div class="multiselect-chips-wrapper">
11363
- <div class="chips" *ngFor="let chip of model">
11364
- <span class="chips-description" [textContent]="chip[displayField]"></span>
11365
- <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
11366
- </div>
11367
- </div>
11368
- </ng-container>
11369
- </co-input-text>
11370
- `,
11380
+ <co-input-text
11381
+ *ngIf="!largeCollection"
11382
+ aria-haspopup="listbox"
11383
+ [attr.aria-expanded]="isSelectOpen"
11384
+ aria-controls="lov-popup"
11385
+ role="combobox"
11386
+ class="no-focus-line"
11387
+ overlayParent
11388
+ #parentForOverlay="overlayParent"
11389
+ type="text"
11390
+ [id]="label"
11391
+ [model]="multiselect ? selectedModels : selectedModel"
11392
+ [placeholder]="label"
11393
+ [readonly]="readonly"
11394
+ [disabled]="disabled"
11395
+ [required]="required"
11396
+ [noClickFocus]="false"
11397
+ [leftIconData]="leftIconData"
11398
+ [rightIcon]="isSelectOpen ? icons.ChevronUpRegular : icons.ChevronDownRegular"
11399
+ [showClearButton]="true"
11400
+ [useContent]="multiselect"
11401
+ [customHeight]="multiselect"
11402
+ [keepFocussed]="keepFocussed"
11403
+ (modelChange)="handleInputModelChange($event)"
11404
+ (click)="openPopup()"
11405
+ (rightIconClick)="toggleSelect()"
11406
+ (keydown)="handleInputKeyDown($event)"
11407
+ (clearIconClick)="clearModel($event)"
11408
+ (blur)="checkModel()">
11409
+ <ng-container *ngIf="multiselect && showChips">
11410
+ <div class="multiselect-chips-wrapper">
11411
+ <div class="chips" *ngFor="let chip of model">
11412
+ <span class="chips-description" [textContent]="chip[displayField]"></span>
11413
+ <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
11414
+ </div>
11415
+ </div>
11416
+ </ng-container>
11417
+ </co-input-text>
11418
+
11419
+ <co-input-text
11420
+ *ngIf="largeCollection"
11421
+ [model]="filterText"
11422
+ [placeholder]="label"
11423
+ [required]="required"
11424
+ [disabled]="disabled"
11425
+ [readonly]="readonly"
11426
+ (modelChange)="onModelChange($event)">
11427
+ </co-input-text>
11428
+ <div *ngIf="isLoading" class="filter-loader"><span></span></div>
11429
+ `,
11371
11430
  providers: [
11372
11431
  OverlayService,
11373
11432
  {
@@ -11382,8 +11441,10 @@ ListOfValuesComponent.propDecorators = {
11382
11441
  model: [{ type: Input }],
11383
11442
  parentForOverlay: [{ type: ViewChild, args: ['parentForOverlay', { read: ElementRef },] }],
11384
11443
  multiselect: [{ type: HostBinding, args: ['class.custom-height',] }, { type: HostBinding, args: ['class.multi-select',] }, { type: Input }],
11444
+ largeCollection: [{ type: Input }],
11385
11445
  displayField: [{ type: Input }],
11386
11446
  collection: [{ type: Input }],
11447
+ collectionLoadFn: [{ type: Input }],
11387
11448
  leftIconData: [{ type: Input }],
11388
11449
  searchPlaceholder: [{ type: Input }],
11389
11450
  label: [{ type: Input }],
@@ -14625,36 +14686,56 @@ class HourSchedulingExpandableTemplateComponent {
14625
14686
  onDragStartCustom === null || onDragStartCustom === void 0 ? void 0 : onDragStartCustom.call(obj);
14626
14687
  event.dataTransfer.setData("text", JSON.stringify({ obj }));
14627
14688
  }
14689
+ leftForObject(index, objects) {
14690
+ if (index === 0) {
14691
+ return 0;
14692
+ }
14693
+ else {
14694
+ return index * this.widthForObject(index, objects);
14695
+ }
14696
+ }
14697
+ widthForObject(index, objects) {
14698
+ if (objects.length > 1) {
14699
+ return 100 / objects.length;
14700
+ }
14701
+ if (objects.length === 1) {
14702
+ return 100;
14703
+ }
14704
+ }
14628
14705
  }
14629
14706
  HourSchedulingExpandableTemplateComponent.decorators = [
14630
14707
  { type: Component, args: [{
14631
14708
  selector: "co-hour-scheduling-expandable-template",
14632
14709
  template: `
14633
- <div
14634
- *ngFor="let obj of objects"
14635
- [class]="'custom-scheduled-object'"
14636
- [class.selected]="obj['selected']"
14637
- [draggable]="!obj['selected']"
14638
- [style.--height]="obj['height'] + 'px'"
14639
- [style.--top]="obj['top'] + 'px'"
14640
- (click)="onSelectBlock(obj)"
14641
- (dragstart)="onExpandableDragStart($event, obj, onDragStartCustom(obj) )">
14710
+ <div class="row">
14711
+ <div
14712
+ *ngFor="let obj of objects"
14713
+ [class]="'custom-scheduled-object'"
14714
+ [class.selected]="obj['selected']"
14715
+ [draggable]="!obj['selected']"
14716
+ [style.--height]="obj['height'] + 'px'"
14717
+ [style.--top]="obj['top'] + 'px'"
14718
+ [style.--left]="leftForObject(objects.indexOf(obj), objects) + '%'"
14719
+ [style.--width]="widthForObject(objects.indexOf(obj), objects) + '%'"
14720
+ (click)="onSelectBlock(obj)"
14721
+ (dragstart)="onExpandableDragStart($event, obj, onDragStartCustom(obj) )">
14642
14722
 
14643
- <div
14644
- *ngIf="obj['selected']"
14645
- class="top-resizer"
14646
- (mousedown)="onResizeStart($event, obj, 'top')"></div>
14647
- <ng-template
14648
- [ngTemplateOutlet]="objectTemplate"
14649
- [ngTemplateOutletContext]="{
14723
+ <div
14724
+ *ngIf="obj['selected']"
14725
+ class="top-resizer"
14726
+ (mousedown)="onResizeStart($event, obj, 'top')"></div>
14727
+ <ng-template
14728
+ [ngTemplateOutlet]="objectTemplate"
14729
+ [ngTemplateOutletContext]="{
14650
14730
  object: obj
14651
14731
  }"
14652
- >
14653
- </ng-template>
14654
- <div *ngIf="obj['selected']"
14655
- class="bottom-resizer"
14656
- (mousedown)="onResizeStart($event, obj, 'bottom')"></div>
14657
- </div>
14732
+ >
14733
+ </ng-template>
14734
+ <div *ngIf="obj['selected']"
14735
+ class="bottom-resizer"
14736
+ (mousedown)="onResizeStart($event, obj, 'bottom')"></div>
14737
+ </div>
14738
+ </div>
14658
14739
  `,
14659
14740
  encapsulation: ViewEncapsulation.None
14660
14741
  },] }