@klippa/ngx-enhancy-forms 14.12.0 → 14.12.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.
@@ -1037,12 +1037,18 @@ class SelectComponent extends ValueAccessorBase {
1037
1037
  async setWidthBasedOnOptionsWidths() {
1038
1038
  if (this.truncateOptions === false) {
1039
1039
  await awaitableForNextCycle();
1040
- const widths = Array.from(this.elRef.nativeElement.querySelectorAll('.ng-option div')).map((e) => e.scrollWidth);
1040
+ const optionRefs = Array.from(this.elRef.nativeElement.querySelectorAll('.ng-option > *'));
1041
+ const widths = optionRefs.map((e) => e.scrollWidth);
1041
1042
  const maxWidth = Math.max(...widths);
1042
1043
  const dropdownPanel = this.elRef.nativeElement.querySelector('ng-dropdown-panel');
1043
1044
  if (dropdownPanel) {
1045
+ const firstOption = this.elRef.nativeElement.querySelector('.ng-option');
1046
+ let padding = 0;
1047
+ if (firstOption) {
1048
+ padding = parseInt(getComputedStyle(firstOption).paddingLeft, 10) + parseInt(getComputedStyle(firstOption).paddingRight, 10);
1049
+ }
1044
1050
  dropdownPanel.style.minWidth = `${this.elRef.nativeElement.clientWidth}px`;
1045
- dropdownPanel.style.width = `${Math.max(this.elRef.nativeElement.clientWidth, maxWidth + 40, dropdownPanel.getBoundingClientRect().width)}px`;
1051
+ dropdownPanel.style.width = `${Math.max(this.elRef.nativeElement.clientWidth, maxWidth + padding, dropdownPanel.getBoundingClientRect().width)}px`;
1046
1052
  await awaitableForNextCycle();
1047
1053
  const pickerWidth = this.elRef.nativeElement.getBoundingClientRect().width;
1048
1054
  const dropdownPanelWidth = dropdownPanel.getBoundingClientRect().width;