slick-components 17.0.82 → 17.0.84

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.
@@ -23,7 +23,7 @@ class SlickInitParams {
23
23
  }
24
24
  }
25
25
  class SlickInitService {
26
- static { this.version = "17.0.82"; }
26
+ static { this.version = "17.0.84"; }
27
27
  constructor() { }
28
28
  static init(initParams) {
29
29
  console.info(`Slick Components Version ${SlickInitService.version}`);
@@ -3268,13 +3268,14 @@ class SlickDropDownComponent {
3268
3268
  return;
3269
3269
  this.isVisible = true;
3270
3270
  this.changeDetector.detectChanges();
3271
- SlickUtilsService.attachElement(this.dropdownList.nativeElement, this.attachTo);
3271
+ const dropdownEl = this.dropdownList.nativeElement;
3272
+ SlickUtilsService.attachElement(dropdownEl, 'body');
3273
+ dropdownEl.style.position = 'absolute';
3274
+ dropdownEl.style.display = 'block';
3275
+ dropdownEl.style.visibility = 'hidden';
3276
+ await new Promise(r => requestAnimationFrame(r)); // ensure layout
3272
3277
  this.reposition();
3273
- await SlickSleepService.sleep();
3274
- this.dropdownList.nativeElement.style.display = "inline-block";
3275
- const selectedItems = this.dropdownList.nativeElement.getElementsByClassName("active");
3276
- if (selectedItems && selectedItems.length > 0)
3277
- selectedItems[0].scrollIntoView({ block: 'nearest' });
3278
+ dropdownEl.style.visibility = 'visible';
3278
3279
  this.expanded = true;
3279
3280
  // This is necessary, otherwise `this` in the reposition function will be window
3280
3281
  // and not the component.
@@ -3294,21 +3295,25 @@ class SlickDropDownComponent {
3294
3295
  this.isVisible = false;
3295
3296
  }
3296
3297
  reposition() {
3297
- const dropDownRect = this.containerDiv.nativeElement.getBoundingClientRect();
3298
- const parentRect = (this.attachTo === 'body') ? null : document.body.querySelector(this.attachTo).getBoundingClientRect();
3299
- const containerLeft = (this.attachTo === 'body') ? dropDownRect.left : (dropDownRect.left - parentRect.left);
3300
- const containerTop = (this.attachTo === 'body') ? dropDownRect.top : (dropDownRect.top - parentRect.top);
3301
- const containerHeight = this.containerDiv.nativeElement.offsetHeight;
3302
- const containerWidth = dropDownRect.width;
3303
- this.width = containerWidth;
3304
- if (this.listWidth === '100%')
3305
- this.listGroupWidth = this.width;
3306
- else if (this.listWidth === 'auto')
3307
- this.listGroupWidth = "auto";
3308
- else
3309
- this.listGroupWidth = this.listWidth;
3310
- this.top = (containerTop + containerHeight);
3311
- this.left = containerLeft;
3298
+ const dropdownEl = this.dropdownList.nativeElement;
3299
+ const containerEl = this.containerDiv.nativeElement;
3300
+ const rect = containerEl.getBoundingClientRect();
3301
+ const dropdownHeight = dropdownEl.offsetHeight;
3302
+ const scrollY = window.pageYOffset;
3303
+ const scrollX = window.pageXOffset;
3304
+ const spaceBelow = window.innerHeight - rect.bottom;
3305
+ let top;
3306
+ // If enough space below show below
3307
+ if (spaceBelow >= dropdownHeight) {
3308
+ top = rect.bottom + scrollY;
3309
+ }
3310
+ // Otherwise show above
3311
+ else {
3312
+ top = rect.top + scrollY - dropdownHeight;
3313
+ }
3314
+ dropdownEl.style.top = top + 'px';
3315
+ dropdownEl.style.left = (rect.left + scrollX) + 'px';
3316
+ dropdownEl.style.width = rect.width + 'px';
3312
3317
  }
3313
3318
  async documentClick(e) {
3314
3319
  // Not entirely sure why, but iPhones call onFocus when clicking out of the dropdown
@@ -6574,6 +6579,10 @@ class SlickGridComponent {
6574
6579
  this.gridOptions.columns.push(column);
6575
6580
  else
6576
6581
  this.gridOptions.columns.splice(idx, 0, column);
6582
+ this.templateRefs = {};
6583
+ this.slickGridColumnTemplates.forEach(t => {
6584
+ this.templateRefs[t.columnKey] = t.template;
6585
+ });
6577
6586
  this.setGridOptions(this.gridOptions);
6578
6587
  }
6579
6588
  getRequestModel(requestModel = null) {