@colijnit/corecomponents_v12 300.1.5 → 300.1.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.
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { Input, Injectable, HostBinding, ViewEncapsulation, Component, Directive, ElementRef, Pipe, EventEmitter, Output, ViewChildren, ViewContainerRef, HostListener, ViewChild, Optional, NgModule, SkipSelf, InjectionToken, Inject, forwardRef, ChangeDetectionStrategy, ContentChildren, LOCALE_ID, NO_ERRORS_SCHEMA, Injector, QueryList } from '@angular/core';
3
+ import { Input, Injectable, HostBinding, ViewEncapsulation, Component, Directive, ElementRef, Pipe, EventEmitter, Output, ViewChildren, ViewContainerRef, HostListener, ViewChild, Optional, NgModule, SkipSelf, InjectionToken, Inject, forwardRef, ChangeDetectionStrategy, ContentChildren, LOCALE_ID, NO_ERRORS_SCHEMA, Injector, RendererStyleFlags2, computed, signal, QueryList } from '@angular/core';
4
4
  import * as i5 from '@angular/forms';
5
5
  import { NgModel, UntypedFormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
6
  import * as i1 from '@angular/platform-browser';
@@ -11461,6 +11461,7 @@ class BaseSimpleGridComponent {
11461
11461
  }
11462
11462
  set data(value) {
11463
11463
  this._data = value;
11464
+ this.repeatSortOnDataChange();
11464
11465
  this._prepareData();
11465
11466
  this._currentDataJSON = JSON.stringify(this._data);
11466
11467
  this.dataChanged.next();
@@ -11568,6 +11569,14 @@ class BaseSimpleGridComponent {
11568
11569
  }
11569
11570
  async prepareDataRow(row, index) {
11570
11571
  }
11572
+ repeatSortOnDataChange() {
11573
+ }
11574
+ setData(value) {
11575
+ this._data = value;
11576
+ this._prepareData();
11577
+ this._currentDataJSON = JSON.stringify(this._data);
11578
+ this.dataChanged.next();
11579
+ }
11571
11580
  _setColumns(columns) {
11572
11581
  this.columns.push(...columns);
11573
11582
  this.columns.sort((a, b) => a.order < b.order ? -1 : 1);
@@ -12239,6 +12248,7 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12239
12248
  _formMaster;
12240
12249
  defaultTextAlign = ColumnAlign.Left;
12241
12250
  scrollDirections = ScrollDirection;
12251
+ _previouslySortedColumn;
12242
12252
  set headerCells(cells) {
12243
12253
  // The header cells are rendered from headerColumnsCopy, so the elementRefs
12244
12254
  // have to be handed back to that same collection.
@@ -12552,14 +12562,18 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12552
12562
  return obj !== col;
12553
12563
  });
12554
12564
  }
12555
- sortColumn(col, columnValue) {
12565
+ sortColumn(col, columnValue, preserveSortDirection) {
12556
12566
  col.isSelected = false;
12557
12567
  if (this.sortColumnValue === columnValue) {
12558
- this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
12568
+ if (!preserveSortDirection) {
12569
+ this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
12570
+ }
12559
12571
  }
12560
12572
  else {
12561
12573
  this.sortColumnValue = columnValue;
12562
- this.sortDirection = 'asc';
12574
+ if (!preserveSortDirection) {
12575
+ this.sortDirection = 'asc';
12576
+ }
12563
12577
  }
12564
12578
  const direction = this.sortDirection === 'asc' ? 1 : -1;
12565
12579
  const sorted = [...this.data].sort((a, b) => {
@@ -12588,9 +12602,15 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12588
12602
  }
12589
12603
  return (valA > valB ? 1 : valA < valB ? -1 : 0) * direction;
12590
12604
  });
12591
- this.data = sorted;
12605
+ this.setData(sorted);
12606
+ this._previouslySortedColumn = col;
12592
12607
  this._detectChanges();
12593
12608
  }
12609
+ repeatSortOnDataChange() {
12610
+ if (this._previouslySortedColumn) {
12611
+ this.sortColumn(this._previouslySortedColumn, this.sortColumnValue, true);
12612
+ }
12613
+ }
12594
12614
  showAllColumns() {
12595
12615
  this.isSettingsMenuOpen = false;
12596
12616
  this.headerColumnsCopy = this.headerColumns;
@@ -14940,184 +14960,701 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
14940
14960
  }]
14941
14961
  }] });
14942
14962
 
14943
- class ListOfIconsComponent {
14944
- icons;
14945
- set collection(value) {
14946
- this._collection = value || [];
14947
- this.activeItem = this.collection[0];
14963
+ const ARROW_CENTER_PROPERTY = '--co-tooltip-arrow-center';
14964
+ const ARROW_EDGE_INSET_PX = 15;
14965
+ const VIEWPORT_MARGIN_PX = 5;
14966
+ const ORIENTATIONS = [CoDirection.Up, CoDirection.Down, CoDirection.Left, CoDirection.Right];
14967
+ const OPPOSITE_ORIENTATION = new Map([
14968
+ [CoDirection.Up, CoDirection.Down],
14969
+ [CoDirection.Down, CoDirection.Up],
14970
+ [CoDirection.Left, CoDirection.Right],
14971
+ [CoDirection.Right, CoDirection.Left]
14972
+ ]);
14973
+ class TooltipComponent {
14974
+ _elementRef;
14975
+ _changeDetector;
14976
+ _renderer;
14977
+ set hostElement(value) {
14978
+ this._hostElement = value;
14979
+ // this._positionTooltip();
14948
14980
  }
14949
- get collection() {
14950
- return this._collection;
14981
+ get hostElement() {
14982
+ return this._hostElement;
14951
14983
  }
14952
- iconSize = 25;
14953
- activeItem;
14954
- itemSelected = new EventEmitter();
14984
+ toolTip;
14985
+ orientation = CoDirection.Up;
14986
+ tooltipClosed = new EventEmitter();
14955
14987
  showClass() {
14956
14988
  return true;
14957
14989
  }
14958
- Icon = CoreComponentsIcon;
14959
- showMenu = false;
14960
- showSubCategories = false;
14961
- _collection = [];
14962
- constructor(icons) {
14963
- this.icons = icons;
14990
+ top = -100;
14991
+ left = -100;
14992
+ get isTop() {
14993
+ return this._resolvedOrientation === CoDirection.Up;
14964
14994
  }
14965
- ngOnInit() {
14966
- if (this.activeItem === undefined) {
14967
- this.activeItem = this.collection[0];
14968
- }
14995
+ get isBottom() {
14996
+ return this._resolvedOrientation === CoDirection.Down;
14969
14997
  }
14970
- toggleMenu() {
14971
- this.showMenu = !this.showMenu;
14998
+ get isLeft() {
14999
+ return this._resolvedOrientation === CoDirection.Left;
14972
15000
  }
14973
- selectItem(item) {
14974
- if (item.children) {
14975
- this.showSubCategories = !this.showSubCategories;
15001
+ get isRight() {
15002
+ return this._resolvedOrientation === CoDirection.Right;
15003
+ }
15004
+ animate = true;
15005
+ _resolvedOrientation = CoDirection.Up;
15006
+ _hostElement;
15007
+ _documentClickListener;
15008
+ constructor(_elementRef, _changeDetector, _renderer) {
15009
+ this._elementRef = _elementRef;
15010
+ this._changeDetector = _changeDetector;
15011
+ this._renderer = _renderer;
15012
+ }
15013
+ ngAfterViewInit() {
15014
+ setTimeout(() => {
15015
+ this._positionTooltip();
15016
+ });
15017
+ this._documentClickListener = this._renderer.listen('document', 'click', (event) => {
15018
+ if (!this._elementRef.nativeElement.contains(event.target)) {
15019
+ this.closeTooltip();
15020
+ }
15021
+ });
15022
+ }
15023
+ ngOnDestroy() {
15024
+ // Remove the click listener to prevent memory leaks
15025
+ if (this._documentClickListener) {
15026
+ this._documentClickListener();
15027
+ }
15028
+ }
15029
+ _positionTooltip() {
15030
+ if (!this.hostElement || !this._elementRef || !this._elementRef.nativeElement) {
14976
15031
  return;
14977
15032
  }
14978
- this.activeItem = item;
14979
- this.showMenu = false;
14980
- this.itemSelected.emit(this.activeItem);
15033
+ const element = this._elementRef.nativeElement;
15034
+ const hostRect = this.hostElement.getBoundingClientRect();
15035
+ this._resolvedOrientation = this._resolveOrientation(hostRect, element.getBoundingClientRect());
15036
+ // Apply the horizontal position first: it determines the available width, and therefore the height.
15037
+ this.left = this._calculateLeft(hostRect, element.getBoundingClientRect());
15038
+ this._changeDetector.detectChanges();
15039
+ const ownRect = element.getBoundingClientRect();
15040
+ this.top = this._calculateTop(hostRect, ownRect);
15041
+ this._positionArrow(hostRect, ownRect);
15042
+ this._changeDetector.markForCheck();
15043
+ this._changeDetector.detectChanges();
14981
15044
  }
14982
- handlePickingCategoryClicked(subCategory) {
14983
- this.activeItem = subCategory;
14984
- this.showMenu = false;
14985
- this.itemSelected.emit(subCategory);
14986
- this.showSubCategories = false;
15045
+ _resolveOrientation(hostRect, ownRect) {
15046
+ const preferred = ORIENTATIONS.indexOf(this.orientation) < 0 ? CoDirection.Up : this.orientation;
15047
+ const opposite = OPPOSITE_ORIENTATION.get(preferred);
15048
+ const candidates = [
15049
+ preferred,
15050
+ opposite,
15051
+ ...ORIENTATIONS.filter((orientation) => orientation !== preferred && orientation !== opposite)
15052
+ ];
15053
+ const fitting = candidates.find((orientation) => this._fits(orientation, hostRect, ownRect));
15054
+ if (fitting) {
15055
+ return fitting;
15056
+ }
15057
+ // Nothing fits: fall back to the side with the most room, so the tooltip overlaps the host as little as possible.
15058
+ return candidates.reduce((best, orientation) => this._availableSpace(orientation, hostRect) > this._availableSpace(best, hostRect) ? orientation : best, preferred);
15059
+ }
15060
+ _fits(orientation, hostRect, ownRect) {
15061
+ switch (orientation) {
15062
+ case CoDirection.Up:
15063
+ return (hostRect.top - ownRect.height) >= VIEWPORT_MARGIN_PX;
15064
+ case CoDirection.Down:
15065
+ return (hostRect.bottom + ownRect.height) <= (document.documentElement.clientHeight - VIEWPORT_MARGIN_PX);
15066
+ case CoDirection.Left:
15067
+ return (hostRect.left - ownRect.width) >= VIEWPORT_MARGIN_PX;
15068
+ default:
15069
+ return (hostRect.right + ownRect.width) <= (document.documentElement.clientWidth - VIEWPORT_MARGIN_PX);
15070
+ }
14987
15071
  }
14988
- onClickOutside() {
14989
- this.showMenu = false;
14990
- this.showSubCategories = false;
15072
+ _availableSpace(orientation, hostRect) {
15073
+ switch (orientation) {
15074
+ case CoDirection.Up:
15075
+ return hostRect.top;
15076
+ case CoDirection.Down:
15077
+ return document.documentElement.clientHeight - hostRect.bottom;
15078
+ case CoDirection.Left:
15079
+ return hostRect.left;
15080
+ default:
15081
+ return document.documentElement.clientWidth - hostRect.right;
15082
+ }
14991
15083
  }
14992
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsComponent, deps: [{ token: IconCacheService }], target: i0.ɵɵFactoryTarget.Component });
14993
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ListOfIconsComponent, isStandalone: false, selector: "co-list-of-icons", inputs: { collection: "collection", iconSize: "iconSize", activeItem: "activeItem" }, outputs: { itemSelected: "itemSelected" }, host: { properties: { "class.co-list-of-icons": "this.showClass" } }, ngImport: i0, template: `
14994
- <div class="icon-item active" [class.menu-opened]="showMenu" (click)="toggleMenu()">
14995
- <co-icon [iconData]="activeItem.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
14996
- @if (!showMenu) {
14997
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
14998
- }
14999
- @if (showMenu) {
15000
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15001
- }
15002
- </div>
15003
- @if (showMenu) {
15004
- <div class="dropdown-menu" (clickOutside)="onClickOutside()">
15005
- @for (item of collection; track item) {
15006
- <div
15007
- class="icon-item"
15008
- [class.active]="item === activeItem"
15009
- (click)="selectItem(item)">
15010
- <co-icon [iconData]="item.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15011
- <div class="label" [textContent]="item.label | coreLocalize"></div>
15012
- @if (showSubCategories && item.children?.length > 0) {
15013
- <div class="picking-type-wrapper">
15014
- @for (subCategory of item.children; track subCategory) {
15015
- <div
15016
- class="button-wrapper"
15017
- (click)="handlePickingCategoryClicked(subCategory)">
15018
- <co-icon
15019
- class="co-transaction-button-bar-icon"
15020
- [iconData]="subCategory.icon"
15021
- [style.width.px]="iconSize"
15022
- [style.height.px]="iconSize">
15023
- </co-icon>
15024
- <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15025
- </div>
15026
- }
15027
- </div>
15028
- }
15029
- </div>
15030
- }
15031
- </div>
15032
- }
15033
- `, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "co-icon", inputs: ["icon", "iconData"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutside", "alwaysTrigger"], outputs: ["clickOutside"], exportAs: ["clickOutside"] }, { kind: "pipe", type: CoreLocalizePipe, name: "coreLocalize" }], encapsulation: i0.ViewEncapsulation.None });
15084
+ _calculateLeft(hostRect, ownRect) {
15085
+ let wantedLeft = hostRect.left; // aligned with the host for the vertical orientations
15086
+ if (this._resolvedOrientation === CoDirection.Left) {
15087
+ wantedLeft = hostRect.left - ownRect.width;
15088
+ }
15089
+ else if (this._resolvedOrientation === CoDirection.Right) {
15090
+ wantedLeft = hostRect.right;
15091
+ }
15092
+ const maxLeft = document.documentElement.clientWidth - ownRect.width - VIEWPORT_MARGIN_PX;
15093
+ return Math.max(VIEWPORT_MARGIN_PX, Math.min(wantedLeft, maxLeft));
15094
+ }
15095
+ _calculateTop(hostRect, ownRect) {
15096
+ // Centred on the host for the horizontal orientations, so the arrow lands halfway up the edge
15097
+ // instead of being clamped against the top corner by hosts that are shorter than the tooltip.
15098
+ let wantedTop = hostRect.top + ((hostRect.height - ownRect.height) / 2);
15099
+ if (this._resolvedOrientation === CoDirection.Up) {
15100
+ wantedTop = hostRect.top - ownRect.height;
15101
+ }
15102
+ else if (this._resolvedOrientation === CoDirection.Down) {
15103
+ wantedTop = hostRect.bottom;
15104
+ }
15105
+ const maxTop = document.documentElement.clientHeight - ownRect.height - VIEWPORT_MARGIN_PX;
15106
+ return Math.max(VIEWPORT_MARGIN_PX, Math.min(wantedTop, maxTop));
15107
+ }
15108
+ _positionArrow(hostRect, ownRect) {
15109
+ const element = this._elementRef.nativeElement;
15110
+ const alongVerticalEdge = this.isLeft || this.isRight;
15111
+ const borderWidth = alongVerticalEdge ? element.clientTop : element.clientLeft;
15112
+ const paddingBoxSize = (alongVerticalEdge ? ownRect.height : ownRect.width) - (2 * borderWidth);
15113
+ const hostCenter = alongVerticalEdge
15114
+ ? (hostRect.top + (hostRect.height / 2)) - this.top - borderWidth
15115
+ : (hostRect.left + (hostRect.width / 2)) - this.left - borderWidth;
15116
+ const maxCenter = Math.max(ARROW_EDGE_INSET_PX, paddingBoxSize - ARROW_EDGE_INSET_PX);
15117
+ const arrowCenter = Math.min(Math.max(hostCenter, ARROW_EDGE_INSET_PX), maxCenter);
15118
+ this._renderer.setStyle(element, ARROW_CENTER_PROPERTY, `${arrowCenter}px`, RendererStyleFlags2.DashCase);
15119
+ }
15120
+ closeTooltip() {
15121
+ this.tooltipClosed.emit();
15122
+ }
15123
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
15124
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: TooltipComponent, isStandalone: false, selector: "co-tooltip", inputs: { hostElement: "hostElement", toolTip: "toolTip", orientation: "orientation" }, outputs: { tooltipClosed: "tooltipClosed" }, host: { properties: { "class.co-tooltip": "this.showClass", "style.top.px": "this.top", "style.left.px": "this.left", "class.top": "this.isTop", "class.bottom": "this.isBottom", "class.left": "this.isLeft", "class.right": "this.isRight", "@showHide": "this.animate" } }, ngImport: i0, template: `
15125
+ <div class="tooltip" [innerHTML]="toolTip"></div>
15126
+ `, isInline: true, animations: [
15127
+ trigger("showHide", [
15128
+ state("void", style({ opacity: 0 })),
15129
+ state("*", style({ opacity: 1 })),
15130
+ transition("void <=> *", animate("200ms ease-in-out")),
15131
+ ])
15132
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
15034
15133
  }
15035
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsComponent, decorators: [{
15134
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipComponent, decorators: [{
15036
15135
  type: Component,
15037
15136
  args: [{
15038
- selector: 'co-list-of-icons',
15137
+ selector: 'co-tooltip',
15039
15138
  template: `
15040
- <div class="icon-item active" [class.menu-opened]="showMenu" (click)="toggleMenu()">
15041
- <co-icon [iconData]="activeItem.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15042
- @if (!showMenu) {
15043
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
15044
- }
15045
- @if (showMenu) {
15046
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15047
- }
15048
- </div>
15049
- @if (showMenu) {
15050
- <div class="dropdown-menu" (clickOutside)="onClickOutside()">
15051
- @for (item of collection; track item) {
15052
- <div
15053
- class="icon-item"
15054
- [class.active]="item === activeItem"
15055
- (click)="selectItem(item)">
15056
- <co-icon [iconData]="item.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15057
- <div class="label" [textContent]="item.label | coreLocalize"></div>
15058
- @if (showSubCategories && item.children?.length > 0) {
15059
- <div class="picking-type-wrapper">
15060
- @for (subCategory of item.children; track subCategory) {
15061
- <div
15062
- class="button-wrapper"
15063
- (click)="handlePickingCategoryClicked(subCategory)">
15064
- <co-icon
15065
- class="co-transaction-button-bar-icon"
15066
- [iconData]="subCategory.icon"
15067
- [style.width.px]="iconSize"
15068
- [style.height.px]="iconSize">
15069
- </co-icon>
15070
- <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15071
- </div>
15072
- }
15073
- </div>
15074
- }
15075
- </div>
15076
- }
15077
- </div>
15078
- }
15079
- `,
15139
+ <div class="tooltip" [innerHTML]="toolTip"></div>
15140
+ `,
15141
+ animations: [
15142
+ trigger("showHide", [
15143
+ state("void", style({ opacity: 0 })),
15144
+ state("*", style({ opacity: 1 })),
15145
+ transition("void <=> *", animate("200ms ease-in-out")),
15146
+ ])
15147
+ ],
15148
+ changeDetection: ChangeDetectionStrategy.OnPush,
15080
15149
  encapsulation: ViewEncapsulation.None,
15081
15150
  standalone: false
15082
15151
  }]
15083
- }], ctorParameters: () => [{ type: IconCacheService }], propDecorators: { collection: [{
15152
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }], propDecorators: { hostElement: [{
15084
15153
  type: Input
15085
- }], iconSize: [{
15154
+ }], toolTip: [{
15086
15155
  type: Input
15087
- }], activeItem: [{
15156
+ }], orientation: [{
15088
15157
  type: Input
15089
- }], itemSelected: [{
15158
+ }], tooltipClosed: [{
15090
15159
  type: Output
15091
15160
  }], showClass: [{
15092
15161
  type: HostBinding,
15093
- args: ['class.co-list-of-icons']
15162
+ args: ['class.co-tooltip']
15163
+ }], top: [{
15164
+ type: HostBinding,
15165
+ args: ["style.top.px"]
15166
+ }], left: [{
15167
+ type: HostBinding,
15168
+ args: ["style.left.px"]
15169
+ }], isTop: [{
15170
+ type: HostBinding,
15171
+ args: ["class.top"]
15172
+ }], isBottom: [{
15173
+ type: HostBinding,
15174
+ args: ["class.bottom"]
15175
+ }], isLeft: [{
15176
+ type: HostBinding,
15177
+ args: ["class.left"]
15178
+ }], isRight: [{
15179
+ type: HostBinding,
15180
+ args: ["class.right"]
15181
+ }], animate: [{
15182
+ type: HostBinding,
15183
+ args: ['@showHide']
15094
15184
  }] } });
15095
15185
 
15096
- class ListOfIconsModule {
15097
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15098
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, declarations: [ListOfIconsComponent], imports: [CommonModule,
15099
- FormsModule,
15100
- IconModule,
15101
- ClickoutsideModule,
15102
- CoreComponentsTranslationModule], exports: [ListOfIconsComponent] });
15103
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, imports: [CommonModule,
15104
- FormsModule,
15105
- IconModule,
15106
- ClickoutsideModule,
15107
- CoreComponentsTranslationModule] });
15186
+ const SHOW_DELAY_PROPERTY = '--co-tooltip-show-delay';
15187
+ const AUTO_HIDE_DELAY_PROPERTY = '--co-tooltip-auto-hide-delay';
15188
+ const DEFAULT_SHOW_DELAY_MS = 400;
15189
+ const DEFAULT_AUTO_HIDE_DELAY_MS = 10000;
15190
+ class TooltipDirective {
15191
+ _compFactoryResolver;
15192
+ _appRef;
15193
+ _injector;
15194
+ _sanitizer;
15195
+ set tooltip(str) {
15196
+ this._tooltipMessage = str;
15197
+ }
15198
+ orientation = CoDirection.Up;
15199
+ _elementRef;
15200
+ _tooltipMessage;
15201
+ _componentRef;
15202
+ _showTimeoutId = undefined;
15203
+ _autoHideTimeoutId = undefined;
15204
+ _mouseEnterHandler = () => this._startShowTimeout();
15205
+ _mouseLeaveHandler = () => this._removeTooltip();
15206
+ _scrollHandler = () => this._handleScroll();
15207
+ constructor(elementRef, _compFactoryResolver, _appRef, _injector, _sanitizer) {
15208
+ this._compFactoryResolver = _compFactoryResolver;
15209
+ this._appRef = _appRef;
15210
+ this._injector = _injector;
15211
+ this._sanitizer = _sanitizer;
15212
+ this._elementRef = elementRef;
15213
+ }
15214
+ ngOnDestroy() {
15215
+ this._removeTooltip();
15216
+ if (this._elementRef && this._elementRef.nativeElement) {
15217
+ this._elementRef.nativeElement.removeEventListener('mouseenter', this._mouseEnterHandler);
15218
+ this._elementRef.nativeElement.removeEventListener('mouseleave', this._mouseLeaveHandler);
15219
+ }
15220
+ window.removeEventListener("scroll", this._scrollHandler);
15221
+ this._elementRef = undefined;
15222
+ }
15223
+ ngOnInit() {
15224
+ window.addEventListener("scroll", this._scrollHandler);
15225
+ if (this._elementRef && this._elementRef.nativeElement) {
15226
+ this._elementRef.nativeElement.addEventListener('mouseenter', this._mouseEnterHandler);
15227
+ this._elementRef.nativeElement.addEventListener('mouseleave', this._mouseLeaveHandler);
15228
+ }
15229
+ }
15230
+ _handleScroll() {
15231
+ this._removeTooltip();
15232
+ }
15233
+ _startShowTimeout() {
15234
+ this._clearShowTimeout();
15235
+ this._showTimeoutId = window.setTimeout(() => {
15236
+ this._showTimeoutId = undefined;
15237
+ this._createTooltipComponent();
15238
+ }, this._resolveDelay(SHOW_DELAY_PROPERTY, DEFAULT_SHOW_DELAY_MS));
15239
+ }
15240
+ // Delays come from custom properties, read from the host so a scoped override wins over the
15241
+ // :root default; falls back when the stylesheet is absent. A bare number is read as milliseconds.
15242
+ _resolveDelay(property, fallback) {
15243
+ if (!this._elementRef || !this._elementRef.nativeElement) {
15244
+ return fallback;
15245
+ }
15246
+ const raw = window.getComputedStyle(this._elementRef.nativeElement)
15247
+ .getPropertyValue(property)
15248
+ .trim();
15249
+ const value = parseFloat(raw);
15250
+ if (isNaN(value)) {
15251
+ return fallback;
15252
+ }
15253
+ return Math.max(0, raw.endsWith('ms') || !raw.endsWith('s') ? value : value * 1000);
15254
+ }
15255
+ _clearShowTimeout() {
15256
+ if (this._showTimeoutId !== undefined) {
15257
+ window.clearTimeout(this._showTimeoutId);
15258
+ this._showTimeoutId = undefined;
15259
+ }
15260
+ }
15261
+ _removeTooltip() {
15262
+ this._clearShowTimeout();
15263
+ this._clearAutoHideTimeout();
15264
+ if (this._componentRef) {
15265
+ this._appRef.detachView(this._componentRef.hostView);
15266
+ this._componentRef.destroy();
15267
+ this._componentRef = undefined;
15268
+ }
15269
+ }
15270
+ _startAutoHideTimeout() {
15271
+ this._clearAutoHideTimeout();
15272
+ const delay = this._resolveDelay(AUTO_HIDE_DELAY_PROPERTY, DEFAULT_AUTO_HIDE_DELAY_MS);
15273
+ if (delay <= 0) { // guard switched off by the consumer
15274
+ return;
15275
+ }
15276
+ this._autoHideTimeoutId = window.setTimeout(() => {
15277
+ this._autoHideTimeoutId = undefined;
15278
+ this._removeTooltip();
15279
+ }, delay);
15280
+ }
15281
+ _clearAutoHideTimeout() {
15282
+ if (this._autoHideTimeoutId !== undefined) {
15283
+ window.clearTimeout(this._autoHideTimeoutId);
15284
+ this._autoHideTimeoutId = undefined;
15285
+ }
15286
+ }
15287
+ _createTooltipComponent() {
15288
+ if (!this._tooltipMessage) {
15289
+ return;
15290
+ }
15291
+ if (this._componentRef) {
15292
+ return;
15293
+ }
15294
+ this._componentRef = this._compFactoryResolver
15295
+ .resolveComponentFactory(TooltipComponent)
15296
+ .create(this._injector);
15297
+ this._componentRef.instance.hostElement = this._elementRef.nativeElement;
15298
+ this._componentRef.instance.orientation = this.orientation;
15299
+ this._componentRef.instance.toolTip = this._sanitizer.bypassSecurityTrustHtml(this._tooltipMessage);
15300
+ this._appRef.attachView(this._componentRef.hostView);
15301
+ const domElem = this._componentRef.hostView.rootNodes[0];
15302
+ document.body.appendChild(domElem);
15303
+ this._startAutoHideTimeout();
15304
+ }
15305
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, deps: [{ token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }, { token: i0.Injector }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Directive });
15306
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: TooltipDirective, isStandalone: false, selector: "[tooltip]", inputs: { tooltip: "tooltip", orientation: ["tooltipOrientation", "orientation"] }, ngImport: i0 });
15108
15307
  }
15109
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, decorators: [{
15110
- type: NgModule,
15308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, decorators: [{
15309
+ type: Directive,
15111
15310
  args: [{
15112
- imports: [
15113
- CommonModule,
15114
- FormsModule,
15115
- IconModule,
15116
- ClickoutsideModule,
15117
- CoreComponentsTranslationModule
15311
+ selector: "[tooltip]",
15312
+ standalone: false
15313
+ }]
15314
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }, { type: i1.DomSanitizer }], propDecorators: { tooltip: [{
15315
+ type: Input,
15316
+ args: ["tooltip"]
15317
+ }], orientation: [{
15318
+ type: Input,
15319
+ args: ["tooltipOrientation"]
15320
+ }] } });
15321
+
15322
+ class ListOfIconsPopupComponent {
15323
+ collection = [];
15324
+ activeItem;
15325
+ parentForOverlay;
15326
+ customCssClass;
15327
+ showLabels = true;
15328
+ itemSelected = new EventEmitter();
15329
+ closePopup = new EventEmitter();
15330
+ showClass() {
15331
+ return true;
15332
+ }
15333
+ showSubCategories = computed(() => this._showSubCategories(), ...(ngDevMode ? [{ debugName: "showSubCategories" }] : []));
15334
+ _showSubCategories = signal(false, ...(ngDevMode ? [{ debugName: "_showSubCategories" }] : []));
15335
+ selectItem(item) {
15336
+ if (item.children) {
15337
+ this._showSubCategories.set(!this._showSubCategories());
15338
+ return;
15339
+ }
15340
+ this.itemSelected.emit(item);
15341
+ }
15342
+ // Stop the bubble: the enclosing .icon-item would otherwise toggle the sub categories again
15343
+ // on a view the parent already destroyed by closing the popup.
15344
+ handlePickingCategoryClicked(subCategory, event) {
15345
+ event.stopPropagation();
15346
+ this.itemSelected.emit(subCategory);
15347
+ }
15348
+ CoDirection = CoDirection;
15349
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsPopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15350
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ListOfIconsPopupComponent, isStandalone: false, selector: "co-list-of-icons-popup", inputs: { collection: "collection", activeItem: "activeItem", parentForOverlay: "parentForOverlay", customCssClass: "customCssClass", showLabels: "showLabels" }, outputs: { itemSelected: "itemSelected", closePopup: "closePopup" }, host: { properties: { "class.co-list-of-icons-popup": "this.showClass" } }, ngImport: i0, template: `
15351
+ <div class="dropdown-menu" id="list-of-icons-popup" role="listbox"
15352
+ [overlay]="parentForOverlay"
15353
+ [ngClass]="customCssClass"
15354
+ [tabindex]="-1"
15355
+ (clickOutside)="closePopup.emit($event)">
15356
+ @for (item of collection; track item) {
15357
+ <div class="icon-item" role="option"
15358
+ [class.active]="item === activeItem"
15359
+ [attr.aria-selected]="item === activeItem"
15360
+ [tooltip]="item.label"
15361
+ [tooltipOrientation]="CoDirection.Left"
15362
+ (click)="selectItem(item)"
15363
+ >
15364
+ <co-icon [iconData]="item.icon"></co-icon>
15365
+ @if (showLabels) {
15366
+ <div class="label" [textContent]="item.label | coreLocalize"></div>
15367
+ }
15368
+ @if (showSubCategories() && item.children?.length > 0) {
15369
+ <div class="picking-type-wrapper">
15370
+ @for (subCategory of item.children; track subCategory) {
15371
+ <div class="button-wrapper" (click)="handlePickingCategoryClicked(subCategory, $event)">
15372
+ <co-icon class="co-transaction-button-bar-icon" [iconData]="subCategory.icon"></co-icon>
15373
+ @if (showLabels) {
15374
+ <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15375
+ }
15376
+ </div>
15377
+ }
15378
+ </div>
15379
+ }
15380
+ </div>
15381
+ }
15382
+ </div>
15383
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: IconComponent, selector: "co-icon", inputs: ["icon", "iconData"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutside", "alwaysTrigger"], outputs: ["clickOutside"], exportAs: ["clickOutside"] }, { kind: "directive", type: OverlayDirective, selector: "[overlay]", inputs: ["overlay", "view", "inline", "keepInView", "inheritWidth", "rightAlign", "fullSize"] }, { kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "tooltipOrientation"] }, { kind: "pipe", type: CoreLocalizePipe, name: "coreLocalize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
15384
+ }
15385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsPopupComponent, decorators: [{
15386
+ type: Component,
15387
+ args: [{
15388
+ selector: 'co-list-of-icons-popup',
15389
+ template: `
15390
+ <div class="dropdown-menu" id="list-of-icons-popup" role="listbox"
15391
+ [overlay]="parentForOverlay"
15392
+ [ngClass]="customCssClass"
15393
+ [tabindex]="-1"
15394
+ (clickOutside)="closePopup.emit($event)">
15395
+ @for (item of collection; track item) {
15396
+ <div class="icon-item" role="option"
15397
+ [class.active]="item === activeItem"
15398
+ [attr.aria-selected]="item === activeItem"
15399
+ [tooltip]="item.label"
15400
+ [tooltipOrientation]="CoDirection.Left"
15401
+ (click)="selectItem(item)"
15402
+ >
15403
+ <co-icon [iconData]="item.icon"></co-icon>
15404
+ @if (showLabels) {
15405
+ <div class="label" [textContent]="item.label | coreLocalize"></div>
15406
+ }
15407
+ @if (showSubCategories() && item.children?.length > 0) {
15408
+ <div class="picking-type-wrapper">
15409
+ @for (subCategory of item.children; track subCategory) {
15410
+ <div class="button-wrapper" (click)="handlePickingCategoryClicked(subCategory, $event)">
15411
+ <co-icon class="co-transaction-button-bar-icon" [iconData]="subCategory.icon"></co-icon>
15412
+ @if (showLabels) {
15413
+ <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15414
+ }
15415
+ </div>
15416
+ }
15417
+ </div>
15418
+ }
15419
+ </div>
15420
+ }
15421
+ </div>
15422
+ `,
15423
+ encapsulation: ViewEncapsulation.None,
15424
+ changeDetection: ChangeDetectionStrategy.OnPush,
15425
+ standalone: false
15426
+ }]
15427
+ }], propDecorators: { collection: [{
15428
+ type: Input
15429
+ }], activeItem: [{
15430
+ type: Input
15431
+ }], parentForOverlay: [{
15432
+ type: Input
15433
+ }], customCssClass: [{
15434
+ type: Input
15435
+ }], showLabels: [{
15436
+ type: Input
15437
+ }], itemSelected: [{
15438
+ type: Output
15439
+ }], closePopup: [{
15440
+ type: Output
15441
+ }], showClass: [{
15442
+ type: HostBinding,
15443
+ args: ['class.co-list-of-icons-popup']
15444
+ }] } });
15445
+
15446
+ class ListOfIconsComponent {
15447
+ icons;
15448
+ _overlayService;
15449
+ _elementRef;
15450
+ set collection(value) {
15451
+ this._collection = value || [];
15452
+ this.activeItem = this.collection[0];
15453
+ }
15454
+ get collection() {
15455
+ return this._collection;
15456
+ }
15457
+ activeItem;
15458
+ showLabels = true;
15459
+ customCssClass;
15460
+ itemSelected = new EventEmitter();
15461
+ showClass() {
15462
+ return true;
15463
+ }
15464
+ Icon = CoreComponentsIcon;
15465
+ showMenu = false;
15466
+ _collection = [];
15467
+ _popupComponentRef;
15468
+ constructor(icons, _overlayService, _elementRef) {
15469
+ this.icons = icons;
15470
+ this._overlayService = _overlayService;
15471
+ this._elementRef = _elementRef;
15472
+ }
15473
+ ngOnInit() {
15474
+ if (this.activeItem === undefined) {
15475
+ this.activeItem = this.collection[0];
15476
+ }
15477
+ }
15478
+ ngOnDestroy() {
15479
+ this.closePopup();
15480
+ }
15481
+ toggleMenu() {
15482
+ if (this.showMenu) {
15483
+ this.closePopup();
15484
+ }
15485
+ else {
15486
+ this.openPopup();
15487
+ }
15488
+ }
15489
+ // The menu is rendered into a component that the OverlayService appends to the document body,
15490
+ // so it escapes the parent DOM (and any overflow / z-index / stacking context there) instead of
15491
+ // being clipped by it.
15492
+ openPopup() {
15493
+ if (this._popupComponentRef) {
15494
+ return;
15495
+ }
15496
+ this.showMenu = true;
15497
+ this._popupComponentRef = this._overlayService.createComponent(ListOfIconsPopupComponent, {
15498
+ parentForOverlay: this._elementRef,
15499
+ customCssClass: this.customCssClass,
15500
+ collection: this.collection,
15501
+ activeItem: this.activeItem,
15502
+ showLabels: this.showLabels
15503
+ }, {
15504
+ itemSelected: (item) => this.selectItem(item),
15505
+ closePopup: () => this.closePopup()
15506
+ });
15507
+ }
15508
+ closePopup() {
15509
+ this.showMenu = false;
15510
+ if (this._popupComponentRef) {
15511
+ this._overlayService.removeComponent(this._popupComponentRef);
15512
+ this._popupComponentRef = undefined;
15513
+ }
15514
+ }
15515
+ selectItem(item) {
15516
+ this.activeItem = item;
15517
+ this.closePopup();
15518
+ this.itemSelected.emit(this.activeItem);
15519
+ }
15520
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsComponent, deps: [{ token: IconCacheService }, { token: OverlayService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
15521
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ListOfIconsComponent, isStandalone: false, selector: "co-list-of-icons", inputs: { collection: "collection", activeItem: "activeItem", showLabels: "showLabels", customCssClass: "customCssClass" }, outputs: { itemSelected: "itemSelected" }, host: { properties: { "class.co-list-of-icons": "this.showClass" } }, providers: [
15522
+ OverlayService
15523
+ ], ngImport: i0, template: `
15524
+ <div class="icon-item active"
15525
+ role="combobox"
15526
+ aria-haspopup="listbox"
15527
+ aria-controls="list-of-icons-popup"
15528
+ [tooltip]="activeItem.label"
15529
+ [attr.aria-expanded]="showMenu"
15530
+ [class.menu-opened]="showMenu"
15531
+ (click)="toggleMenu()">
15532
+ <co-icon [iconData]="activeItem.icon"></co-icon>
15533
+ @if (!showMenu) {
15534
+ <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
15535
+ }
15536
+ @if (showMenu) {
15537
+ <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15538
+ }
15539
+ </div>
15540
+ `, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "co-icon", inputs: ["icon", "iconData"] }, { kind: "directive", type: TooltipDirective, selector: "[tooltip]", inputs: ["tooltip", "tooltipOrientation"] }], encapsulation: i0.ViewEncapsulation.None });
15541
+ }
15542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsComponent, decorators: [{
15543
+ type: Component,
15544
+ args: [{
15545
+ selector: 'co-list-of-icons',
15546
+ template: `
15547
+ <div class="icon-item active"
15548
+ role="combobox"
15549
+ aria-haspopup="listbox"
15550
+ aria-controls="list-of-icons-popup"
15551
+ [tooltip]="activeItem.label"
15552
+ [attr.aria-expanded]="showMenu"
15553
+ [class.menu-opened]="showMenu"
15554
+ (click)="toggleMenu()">
15555
+ <co-icon [iconData]="activeItem.icon"></co-icon>
15556
+ @if (!showMenu) {
15557
+ <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
15558
+ }
15559
+ @if (showMenu) {
15560
+ <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15561
+ }
15562
+ </div>
15563
+ `,
15564
+ providers: [
15565
+ OverlayService
15566
+ ],
15567
+ encapsulation: ViewEncapsulation.None,
15568
+ standalone: false
15569
+ }]
15570
+ }], ctorParameters: () => [{ type: IconCacheService }, { type: OverlayService }, { type: i0.ElementRef }], propDecorators: { collection: [{
15571
+ type: Input
15572
+ }], activeItem: [{
15573
+ type: Input
15574
+ }], showLabels: [{
15575
+ type: Input
15576
+ }], customCssClass: [{
15577
+ type: Input
15578
+ }], itemSelected: [{
15579
+ type: Output
15580
+ }], showClass: [{
15581
+ type: HostBinding,
15582
+ args: ['class.co-list-of-icons']
15583
+ }] } });
15584
+
15585
+ class TooltipModule {
15586
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15587
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, declarations: [TooltipComponent], imports: [CommonModule], exports: [TooltipComponent] });
15588
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, imports: [CommonModule] });
15589
+ }
15590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, decorators: [{
15591
+ type: NgModule,
15592
+ args: [{
15593
+ imports: [
15594
+ CommonModule
15118
15595
  ],
15119
15596
  declarations: [
15120
- ListOfIconsComponent
15597
+ TooltipComponent
15598
+ ],
15599
+ exports: [
15600
+ TooltipComponent
15601
+ ]
15602
+ }]
15603
+ }] });
15604
+
15605
+ class TooltipDirectiveModule {
15606
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15607
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, declarations: [TooltipDirective], imports: [TooltipModule], exports: [TooltipDirective] });
15608
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, imports: [TooltipModule] });
15609
+ }
15610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, decorators: [{
15611
+ type: NgModule,
15612
+ args: [{
15613
+ imports: [
15614
+ TooltipModule
15615
+ ],
15616
+ declarations: [
15617
+ TooltipDirective
15618
+ ],
15619
+ exports: [
15620
+ TooltipDirective
15621
+ ]
15622
+ }]
15623
+ }] });
15624
+
15625
+ class ListOfIconsModule {
15626
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15627
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, declarations: [ListOfIconsComponent,
15628
+ ListOfIconsPopupComponent], imports: [CommonModule,
15629
+ FormsModule,
15630
+ IconModule,
15631
+ ClickoutsideModule,
15632
+ OverlayModule,
15633
+ CoreComponentsTranslationModule,
15634
+ TooltipDirectiveModule], exports: [ListOfIconsComponent] });
15635
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, imports: [CommonModule,
15636
+ FormsModule,
15637
+ IconModule,
15638
+ ClickoutsideModule,
15639
+ OverlayModule,
15640
+ CoreComponentsTranslationModule,
15641
+ TooltipDirectiveModule] });
15642
+ }
15643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, decorators: [{
15644
+ type: NgModule,
15645
+ args: [{
15646
+ imports: [
15647
+ CommonModule,
15648
+ FormsModule,
15649
+ IconModule,
15650
+ ClickoutsideModule,
15651
+ OverlayModule,
15652
+ CoreComponentsTranslationModule,
15653
+ TooltipDirectiveModule
15654
+ ],
15655
+ declarations: [
15656
+ ListOfIconsComponent,
15657
+ ListOfIconsPopupComponent
15121
15658
  ],
15122
15659
  exports: [
15123
15660
  ListOfIconsComponent
@@ -18126,242 +18663,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
18126
18663
  }]
18127
18664
  }] });
18128
18665
 
18129
- class TooltipComponent {
18130
- _elementRef;
18131
- _changeDetector;
18132
- _renderer;
18133
- set hostElement(value) {
18134
- this._hostElement = value;
18135
- // this._positionTooltip();
18136
- }
18137
- get hostElement() {
18138
- return this._hostElement;
18139
- }
18140
- toolTip;
18141
- tooltipClosed = new EventEmitter();
18142
- showClass() {
18143
- return true;
18144
- }
18145
- top = -100;
18146
- left = -100;
18147
- bottom = false;
18148
- animate = true;
18149
- _hostElement;
18150
- _documentClickListener;
18151
- constructor(_elementRef, _changeDetector, _renderer) {
18152
- this._elementRef = _elementRef;
18153
- this._changeDetector = _changeDetector;
18154
- this._renderer = _renderer;
18155
- }
18156
- ngAfterViewInit() {
18157
- setTimeout(() => {
18158
- this._positionTooltip();
18159
- });
18160
- this._documentClickListener = this._renderer.listen('document', 'click', (event) => {
18161
- if (!this._elementRef.nativeElement.contains(event.target)) {
18162
- this.closeTooltip();
18163
- }
18164
- });
18165
- }
18166
- ngOnDestroy() {
18167
- // Remove the click listener to prevent memory leaks
18168
- if (this._documentClickListener) {
18169
- this._documentClickListener();
18170
- }
18171
- }
18172
- _positionTooltip() {
18173
- if (this.hostElement && this._elementRef && this._elementRef.nativeElement) {
18174
- const rect = this.hostElement.getBoundingClientRect();
18175
- const ownRect = this._elementRef.nativeElement.getBoundingClientRect();
18176
- let wantedLeft = rect.left;
18177
- let wantedTop = rect.top - ownRect.height;
18178
- if (wantedTop < 0) { // out of view, move to bottom
18179
- this.bottom = true;
18180
- wantedTop = rect.bottom;
18181
- }
18182
- else {
18183
- this.bottom = false;
18184
- }
18185
- this.left = wantedLeft;
18186
- this.top = wantedTop;
18187
- this._changeDetector.markForCheck();
18188
- this._changeDetector.detectChanges();
18189
- }
18190
- }
18191
- closeTooltip() {
18192
- this.tooltipClosed.emit();
18193
- }
18194
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
18195
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: TooltipComponent, isStandalone: false, selector: "co-tooltip", inputs: { hostElement: "hostElement", toolTip: "toolTip" }, outputs: { tooltipClosed: "tooltipClosed" }, host: { properties: { "class.co-tooltip": "this.showClass", "style.top.px": "this.top", "style.left.px": "this.left", "class.bottom": "this.bottom", "@showHide": "this.animate" } }, ngImport: i0, template: `
18196
- <div class="tooltip" [innerHTML]="toolTip"></div>
18197
- `, isInline: true, animations: [
18198
- trigger("showHide", [
18199
- state("void", style({ opacity: 0 })),
18200
- state("*", style({ opacity: 1 })),
18201
- transition("void <=> *", animate("200ms ease-in-out")),
18202
- ])
18203
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
18204
- }
18205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipComponent, decorators: [{
18206
- type: Component,
18207
- args: [{
18208
- selector: 'co-tooltip',
18209
- template: `
18210
- <div class="tooltip" [innerHTML]="toolTip"></div>
18211
- `,
18212
- animations: [
18213
- trigger("showHide", [
18214
- state("void", style({ opacity: 0 })),
18215
- state("*", style({ opacity: 1 })),
18216
- transition("void <=> *", animate("200ms ease-in-out")),
18217
- ])
18218
- ],
18219
- changeDetection: ChangeDetectionStrategy.OnPush,
18220
- encapsulation: ViewEncapsulation.None,
18221
- standalone: false
18222
- }]
18223
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }], propDecorators: { hostElement: [{
18224
- type: Input
18225
- }], toolTip: [{
18226
- type: Input
18227
- }], tooltipClosed: [{
18228
- type: Output
18229
- }], showClass: [{
18230
- type: HostBinding,
18231
- args: ['class.co-tooltip']
18232
- }], top: [{
18233
- type: HostBinding,
18234
- args: ["style.top.px"]
18235
- }], left: [{
18236
- type: HostBinding,
18237
- args: ["style.left.px"]
18238
- }], bottom: [{
18239
- type: HostBinding,
18240
- args: ["class.bottom"]
18241
- }], animate: [{
18242
- type: HostBinding,
18243
- args: ['@showHide']
18244
- }] } });
18245
-
18246
- class TooltipDirective {
18247
- _compFactoryResolver;
18248
- _appRef;
18249
- _injector;
18250
- _sanitizer;
18251
- set tooltip(str) {
18252
- this._tooltipMessage = str;
18253
- }
18254
- _elementRef;
18255
- _tooltipMessage;
18256
- _componentRef;
18257
- constructor(elementRef, _compFactoryResolver, _appRef, _injector, _sanitizer) {
18258
- this._compFactoryResolver = _compFactoryResolver;
18259
- this._appRef = _appRef;
18260
- this._injector = _injector;
18261
- this._sanitizer = _sanitizer;
18262
- this._elementRef = elementRef;
18263
- }
18264
- ngOnDestroy() {
18265
- if (this._elementRef && this._elementRef.nativeElement) {
18266
- this._elementRef.nativeElement.removeEventListener('mouseenter', (event) => this._handleMouseMove(event));
18267
- this._elementRef.nativeElement.removeEventListener('mouseleave', () => this._removeTooltip());
18268
- }
18269
- window.removeEventListener("scroll", (event) => this._handleScroll);
18270
- this._elementRef = undefined;
18271
- }
18272
- ngOnInit() {
18273
- window.addEventListener("scroll", (event) => this._handleScroll);
18274
- if (this._elementRef && this._elementRef.nativeElement) {
18275
- this._elementRef.nativeElement.addEventListener('mouseenter', (event) => this._handleMouseMove(event));
18276
- this._elementRef.nativeElement.addEventListener('mouseleave', () => this._removeTooltip());
18277
- }
18278
- }
18279
- _handleScroll() {
18280
- this._removeTooltip();
18281
- }
18282
- _handleMouseMove(event) {
18283
- this._showTooltip(event.clientY, event.clientX);
18284
- }
18285
- _showTooltip(top, left) {
18286
- this._createTooltipComponent(top, left);
18287
- }
18288
- _removeTooltip() {
18289
- if (this._componentRef) {
18290
- this._appRef.detachView(this._componentRef.hostView);
18291
- this._componentRef.destroy();
18292
- this._componentRef = undefined;
18293
- }
18294
- }
18295
- _createTooltipComponent(top, left) {
18296
- if (!this._tooltipMessage) {
18297
- return;
18298
- }
18299
- if (this._componentRef) {
18300
- return;
18301
- }
18302
- this._componentRef = this._compFactoryResolver
18303
- .resolveComponentFactory(TooltipComponent)
18304
- .create(this._injector);
18305
- this._componentRef.instance.hostElement = this._elementRef.nativeElement;
18306
- this._componentRef.instance.toolTip = this._sanitizer.bypassSecurityTrustHtml(this._tooltipMessage);
18307
- this._appRef.attachView(this._componentRef.hostView);
18308
- const domElem = this._componentRef.hostView.rootNodes[0];
18309
- document.body.appendChild(domElem);
18310
- }
18311
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, deps: [{ token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }, { token: i0.Injector }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Directive });
18312
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: TooltipDirective, isStandalone: false, selector: "[tooltip]", inputs: { tooltip: "tooltip" }, ngImport: i0 });
18313
- }
18314
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, decorators: [{
18315
- type: Directive,
18316
- args: [{
18317
- selector: "[tooltip]",
18318
- standalone: false
18319
- }]
18320
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }, { type: i1.DomSanitizer }], propDecorators: { tooltip: [{
18321
- type: Input,
18322
- args: ["tooltip"]
18323
- }] } });
18324
-
18325
- class TooltipModule {
18326
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18327
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, declarations: [TooltipComponent], imports: [CommonModule], exports: [TooltipComponent] });
18328
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, imports: [CommonModule] });
18329
- }
18330
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, decorators: [{
18331
- type: NgModule,
18332
- args: [{
18333
- imports: [
18334
- CommonModule
18335
- ],
18336
- declarations: [
18337
- TooltipComponent
18338
- ],
18339
- exports: [
18340
- TooltipComponent
18341
- ]
18342
- }]
18343
- }] });
18344
-
18345
- class TooltipDirectiveModule {
18346
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18347
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, declarations: [TooltipDirective], imports: [TooltipModule], exports: [TooltipDirective] });
18348
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, imports: [TooltipModule] });
18349
- }
18350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, decorators: [{
18351
- type: NgModule,
18352
- args: [{
18353
- imports: [
18354
- TooltipModule
18355
- ],
18356
- declarations: [
18357
- TooltipDirective
18358
- ],
18359
- exports: [
18360
- TooltipDirective
18361
- ]
18362
- }]
18363
- }] });
18364
-
18365
18666
  // Base screen configuration service for one "screen module", e.g. 'Crm'. Db-loads, stores and and interprets ObjectConfiguration config objects.
18366
18667
  class BaseModuleScreenConfigService {
18367
18668
  // emits the params of the loaded config, each time when a new config was loaded