adb-shared 7.0.4 → 7.0.6

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.
@@ -515,19 +515,20 @@ class AdbDropdownDirective {
515
515
  setMenuPosition(toggleButton, menu) {
516
516
  const buttonRect = toggleButton.getBoundingClientRect();
517
517
  const menuRect = menu.getBoundingClientRect();
518
+ const dropdownRect = toggleButton.parentElement.getBoundingClientRect();
518
519
  const spaceAbove = buttonRect.top;
519
520
  const spaceBelow = window.innerHeight - buttonRect.bottom;
520
- const spaceRight = window.innerWidth - buttonRect.left;
521
- const spaceLeft = buttonRect.right;
522
- let x = 0;
521
+ const spaceRight = window.innerWidth - buttonRect.right;
522
+ const spaceLeft = buttonRect.left;
523
+ let x = buttonRect.left - dropdownRect.left;
523
524
  let y = 0;
524
525
  // Open upwards if there isn't enough room below
525
526
  if (menuRect.height > spaceBelow && spaceAbove > spaceBelow) {
526
- y = -buttonRect.height - menuRect.height - 1;
527
+ y = -menuRect.height;
527
528
  }
528
529
  // Open towards the left if there isn't enough room to the right
529
530
  if (menuRect.width > spaceRight && spaceLeft > spaceRight) {
530
- x = buttonRect.width - menuRect.width;
531
+ x = buttonRect.right - dropdownRect.left - menuRect.width;
531
532
  }
532
533
  menu.style.transform = `translate3d(${x}px, ${y}px, 0px)`;
533
534
  }
@@ -547,6 +548,17 @@ class AdbDropdownDirective {
547
548
  this.expanded = false;
548
549
  }
549
550
  }
551
+ onResize() {
552
+ if (!this.expanded) {
553
+ return;
554
+ }
555
+ const node = this.elementRef.nativeElement.parentNode;
556
+ const toggleButton = node.querySelector('.dropdown-toggle');
557
+ const menu = node.querySelector('.dropdown-menu');
558
+ if (toggleButton && menu?.classList.contains('show')) {
559
+ this.setMenuPosition(toggleButton, menu);
560
+ }
561
+ }
550
562
  close() {
551
563
  const node = this.elementRef.nativeElement.parentNode;
552
564
  const menu = node.querySelector('.dropdown-menu');
@@ -557,7 +569,7 @@ class AdbDropdownDirective {
557
569
  return '' + Math.floor(Math.random() * Date.now());
558
570
  }
559
571
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbDropdownDirective, deps: [{ token: i0.ElementRef }, { token: AdbDropdownService }], target: i0.ɵɵFactoryTarget.Directive });
560
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.21", type: AdbDropdownDirective, isStandalone: false, selector: "[adbDropdown]", inputs: { insideClickSignal: { classPropertyName: "insideClickSignal", publicName: "insideClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { adbDropdownSignal: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded", "attr.aria-controls": "this.dropId" } }, exportAs: ["adbDropdown"], ngImport: i0 });
572
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.21", type: AdbDropdownDirective, isStandalone: false, selector: "[adbDropdown]", inputs: { insideClickSignal: { classPropertyName: "insideClickSignal", publicName: "insideClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { adbDropdownSignal: "adbDropdown" }, host: { listeners: { "click": "onClick()", "document:click": "onCheckOutSideClick($event.target)", "window:resize": "onResize()" }, properties: { "id": "this.id", "attr.data-toggle": "this.dataToggle", "attr.aria-haspopup": "this.haspPopup", "attr.aria-expanded": "this.expanded", "attr.aria-controls": "this.dropId" } }, exportAs: ["adbDropdown"], ngImport: i0 });
561
573
  }
562
574
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbDropdownDirective, decorators: [{
563
575
  type: Directive,
@@ -587,6 +599,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImpo
587
599
  }], onCheckOutSideClick: [{
588
600
  type: HostListener,
589
601
  args: ['document:click', ['$event.target']]
602
+ }], onResize: [{
603
+ type: HostListener,
604
+ args: ['window:resize']
590
605
  }] } });
591
606
 
592
607
  class AdbDropdownModule {
@@ -1924,7 +1939,7 @@ class RichTextComponent {
1924
1939
  };
1925
1940
  while (i < input.length) {
1926
1941
  if (input.startsWith('**', i) || input.startsWith('__', i)) {
1927
- const marker = input.substr(i, 2);
1942
+ const marker = input.slice(i, i + 2);
1928
1943
  const end = input.indexOf(marker, i + 2);
1929
1944
  if (end !== -1) {
1930
1945
  parts.push({
@@ -1955,7 +1970,7 @@ class RichTextComponent {
1955
1970
  const label = input.slice(i + 1, textEnd);
1956
1971
  const link = input.slice(linkStart + 1, linkEnd);
1957
1972
  const [type, id] = link.split(':');
1958
- if (type === 'taxon' || type === 'term' || type === 'reference') {
1973
+ if (type === 'taxon' || type === 'reference') {
1959
1974
  parts.push({
1960
1975
  type: type,
1961
1976
  content: label,
@@ -2026,22 +2041,22 @@ class FilterSectionComponent {
2026
2041
  templateSignal = contentChild(TemplateRef, ...(ngDevMode ? [{ debugName: "templateSignal" }] : /* istanbul ignore next */ []));
2027
2042
  id = `filter-section-${Math.floor(Math.random() * Date.now())}`;
2028
2043
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: FilterSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2029
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.21", type: FilterSectionComponent, isStandalone: false, selector: "adb-filter-section", inputs: { countSignal: { classPropertyName: "countSignal", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, titleResourceSignal: { classPropertyName: "titleResourceSignal", publicName: "titleResource", isSignal: true, isRequired: false, transformFunction: null }, helpResourceSignal: { classPropertyName: "helpResourceSignal", publicName: "helpResource", isSignal: true, isRequired: false, transformFunction: null }, lazySignal: { classPropertyName: "lazySignal", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, expandedSignal: { classPropertyName: "expandedSignal", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedSignal: "expandedChange" }, queries: [{ propertyName: "templateSignal", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n <div class=\"d-flex align-items-center\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>{{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n {{ helpResourceSignal() | translate }}\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: ["buttonClass", "label"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2044
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.21", type: FilterSectionComponent, isStandalone: false, selector: "adb-filter-section", inputs: { countSignal: { classPropertyName: "countSignal", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, titleResourceSignal: { classPropertyName: "titleResourceSignal", publicName: "titleResource", isSignal: true, isRequired: false, transformFunction: null }, helpResourceSignal: { classPropertyName: "helpResourceSignal", publicName: "helpResource", isSignal: true, isRequired: false, transformFunction: null }, lazySignal: { classPropertyName: "lazySignal", publicName: "lazy", isSignal: true, isRequired: false, transformFunction: null }, expandedSignal: { classPropertyName: "expandedSignal", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedSignal: "expandedChange" }, queries: [{ propertyName: "templateSignal", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n <div class=\"d-flex align-items-center\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>{{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n <adb-rich-text [text]=\"helpResourceSignal() | translate\"></adb-rich-text>\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}", dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AdbHelpButtonComponent, selector: "adb-help-button", inputs: ["buttonClass", "label"] }, { kind: "component", type: RichTextComponent, selector: "adb-rich-text", inputs: ["text"] }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2030
2045
  }
2031
2046
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: FilterSectionComponent, decorators: [{
2032
2047
  type: Component,
2033
- args: [{ selector: 'adb-filter-section', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n <div class=\"d-flex align-items-center\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>{{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n {{ helpResourceSignal() | translate }}\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}" }]
2048
+ args: [{ selector: 'adb-filter-section', changeDetection: ChangeDetectionStrategy.Eager, standalone: false, template: "<button [attr.aria-expanded]=\"expandedSignal()\" [attr.aria-controls]=\"id\" class=\"btn btn-invisible px-1\" type=\"button\" (click)=\"expandedSignal.update(value => !value)\">\r\n <div class=\"d-flex align-items-center gap-1 flex-wrap\">\r\n @if (countSignal() > 0) {\r\n <div class=\"badge bg-primary\">{{ countSignal() }}</div>\r\n }\r\n <div class=\"d-flex align-items-center\">\r\n <span [ngClass]=\"expandedSignal()? 'bi bi-chevron-down': 'bi bi-chevron-right'\"></span>{{ titleResourceSignal() | translate }}\r\n </div>\r\n @if (helpResourceSignal()) {\r\n <adb-help-button (click)=\"$event.stopPropagation()\">\r\n <adb-rich-text [text]=\"helpResourceSignal() | translate\"></adb-rich-text>\r\n </adb-help-button>\r\n }\r\n </div>\r\n</button>\r\n@if (expandedSignal()) {\r\n<div class=\"px-3 pb-3 border-bottom\" [id]=\"id\">\r\n @if (lazySignal() && templateSignal()) {\r\n <ng-container *ngTemplateOutlet=\"templateSignal()\"></ng-container>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</div>\r\n}" }]
2034
2049
  }], propDecorators: { countSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], titleResourceSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleResource", required: false }] }], helpResourceSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "helpResource", required: false }] }], lazySignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "lazy", required: false }] }], expandedSignal: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }], templateSignal: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
2035
2050
 
2036
2051
  class AdbFilterSectionModule {
2037
2052
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2038
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, declarations: [FilterSectionComponent], imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule], exports: [FilterSectionComponent, AdbButtonsModule] });
2039
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule, AdbButtonsModule] });
2053
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, declarations: [FilterSectionComponent], imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule, AdbRichEditorModule], exports: [FilterSectionComponent, AdbButtonsModule] });
2054
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule, AdbRichEditorModule, AdbButtonsModule] });
2040
2055
  }
2041
2056
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.21", ngImport: i0, type: AdbFilterSectionModule, decorators: [{
2042
2057
  type: NgModule,
2043
2058
  args: [{
2044
- imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule],
2059
+ imports: [CommonModule, FormsModule, AdbButtonsModule, TranslateModule, AdbRichEditorModule],
2045
2060
  declarations: [FilterSectionComponent],
2046
2061
  exports: [FilterSectionComponent, AdbButtonsModule]
2047
2062
  }]