@colijnit/corecomponents_v12 300.1.4 → 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);
@@ -11942,35 +11951,17 @@ class SimpleGridCellComponent {
11942
11951
  _changeDetector;
11943
11952
  _injector;
11944
11953
  _formComponent;
11945
- get editMode() {
11946
- return this._editMode;
11947
- }
11948
- set editMode(value) {
11949
- this._editMode = value;
11950
- }
11954
+ editMode;
11951
11955
  defaultTextAlign = ColumnAlign.Left;
11952
- set editTemplateContent(template) {
11953
- if (template) {
11954
- this._editTemplate = template;
11955
- this._setFocusComponent();
11956
- }
11957
- }
11958
- set noEditTemplateContent(template) {
11959
- if (template) {
11960
- this._template = template;
11961
- this._setFocusComponent();
11962
- }
11963
- }
11964
- set noTemplateContent(template) {
11965
- if (template) {
11966
- this._inputTemplate = template;
11956
+ set cellFieldContent(element) {
11957
+ if (element) {
11958
+ this._cellField = element;
11967
11959
  this._setFocusComponent();
11968
11960
  }
11969
11961
  }
11970
11962
  column;
11971
11963
  row;
11972
11964
  columnInjector;
11973
- _editMode = false;
11974
11965
  set fieldEditMode(value) {
11975
11966
  this._fieldEditMode = value;
11976
11967
  this._setFocusComponent();
@@ -11989,9 +11980,7 @@ class SimpleGridCellComponent {
11989
11980
  }
11990
11981
  _fieldEditMode = false;
11991
11982
  _focused = false;
11992
- _editTemplate;
11993
- _template;
11994
- _inputTemplate;
11983
+ _cellField;
11995
11984
  constructor(_changeDetector, _injector, _formComponent) {
11996
11985
  this._changeDetector = _changeDetector;
11997
11986
  this._injector = _injector;
@@ -12006,7 +11995,7 @@ class SimpleGridCellComponent {
12006
11995
  });
12007
11996
  }
12008
11997
  _setFocusComponent() {
12009
- if (this._editMode && this.fieldEditMode) {
11998
+ if (this.editMode && this.fieldEditMode) {
12010
11999
  const element = this._getElement();
12011
12000
  if (element) {
12012
12001
  const focusEvent = this._createNewEvent(element, 'focus');
@@ -12050,22 +12039,10 @@ class SimpleGridCellComponent {
12050
12039
  return event;
12051
12040
  }
12052
12041
  _getElement() {
12053
- let templ;
12054
- if (this._editTemplate) {
12055
- templ = this._editTemplate;
12056
- }
12057
- else if (this._template) {
12058
- templ = this._template;
12059
- }
12060
- else {
12061
- templ = this._inputTemplate;
12062
- }
12063
- if (templ) {
12064
- if (templ && templ.elementRef) {
12065
- const inputElement = this._getFirstFormInput(templ.elementRef.nativeElement.parentElement);
12066
- if (inputElement) {
12067
- return inputElement;
12068
- }
12042
+ if (this._cellField && this._cellField.nativeElement) {
12043
+ const inputElement = this._getFirstFormInput(this._cellField.nativeElement);
12044
+ if (inputElement) {
12045
+ return inputElement;
12069
12046
  }
12070
12047
  }
12071
12048
  }
@@ -12073,12 +12050,12 @@ class SimpleGridCellComponent {
12073
12050
  this._changeDetector.detectChanges();
12074
12051
  }
12075
12052
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SimpleGridCellComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: FormComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component });
12076
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SimpleGridCellComponent, isStandalone: false, selector: "co-simple-grid-cell", inputs: { editMode: "editMode", column: "column", row: "row", fieldEditMode: "fieldEditMode" }, outputs: { cellClick: "cellClick" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class.co-simple-grid-cell": "this.showClass" } }, viewQueries: [{ propertyName: "editTemplateContent", first: true, predicate: ["editTemplate"], descendants: true, read: BaseInputComponent }, { propertyName: "noEditTemplateContent", first: true, predicate: ["noEditTemplate"], descendants: true }, { propertyName: "noTemplateContent", first: true, predicate: ["noTemplate"], descendants: true }], ngImport: i0, template: `
12053
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: SimpleGridCellComponent, isStandalone: false, selector: "co-simple-grid-cell", inputs: { editMode: "editMode", column: "column", row: "row", fieldEditMode: "fieldEditMode" }, outputs: { cellClick: "cellClick" }, host: { listeners: { "click": "handleClick($event)" }, properties: { "class.co-simple-grid-cell": "this.showClass" } }, viewQueries: [{ propertyName: "cellFieldContent", first: true, predicate: ["cellField"], descendants: true }], ngImport: i0, template: `
12077
12054
  <div class="simple-grid-column-cell-value" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
12078
12055
  @if (editMode) {
12079
- <div class="simple-grid-column-cell-field">
12056
+ <div #cellField class="simple-grid-column-cell-field">
12080
12057
  @if (column.editTemplate) {
12081
- <ng-container #editTemplate
12058
+ <ng-container
12082
12059
  [ngTemplateOutlet]="column.editTemplate"
12083
12060
  [ngTemplateOutletInjector]="columnInjector"
12084
12061
  [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
@@ -12092,7 +12069,7 @@ class SimpleGridCellComponent {
12092
12069
  }
12093
12070
  </div>
12094
12071
  } @else {
12095
- <div class="simple-grid-column-cell-field">
12072
+ <div #cellField class="simple-grid-column-cell-field">
12096
12073
  @if (column.template) {
12097
12074
  <ng-container [ngTemplateOutlet]="column.template"
12098
12075
  [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
@@ -12111,9 +12088,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
12111
12088
  template: `
12112
12089
  <div class="simple-grid-column-cell-value" [ngClass]="column.textAlign ? column.textAlign : defaultTextAlign">
12113
12090
  @if (editMode) {
12114
- <div class="simple-grid-column-cell-field">
12091
+ <div #cellField class="simple-grid-column-cell-field">
12115
12092
  @if (column.editTemplate) {
12116
- <ng-container #editTemplate
12093
+ <ng-container
12117
12094
  [ngTemplateOutlet]="column.editTemplate"
12118
12095
  [ngTemplateOutletInjector]="columnInjector"
12119
12096
  [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
@@ -12127,7 +12104,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
12127
12104
  }
12128
12105
  </div>
12129
12106
  } @else {
12130
- <div class="simple-grid-column-cell-field">
12107
+ <div #cellField class="simple-grid-column-cell-field">
12131
12108
  @if (column.template) {
12132
12109
  <ng-container [ngTemplateOutlet]="column.template"
12133
12110
  [ngTemplateOutletContext]="{value: row[column.field], row: row}"></ng-container>
@@ -12145,15 +12122,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
12145
12122
  type: Optional
12146
12123
  }] }], propDecorators: { editMode: [{
12147
12124
  type: Input
12148
- }], editTemplateContent: [{
12149
- type: ViewChild,
12150
- args: ["editTemplate", { read: BaseInputComponent }]
12151
- }], noEditTemplateContent: [{
12152
- type: ViewChild,
12153
- args: ["noEditTemplate"]
12154
- }], noTemplateContent: [{
12125
+ }], cellFieldContent: [{
12155
12126
  type: ViewChild,
12156
- args: ["noTemplate"]
12127
+ args: ["cellField"]
12157
12128
  }], column: [{
12158
12129
  type: Input
12159
12130
  }], row: [{
@@ -12277,10 +12248,13 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12277
12248
  _formMaster;
12278
12249
  defaultTextAlign = ColumnAlign.Left;
12279
12250
  scrollDirections = ScrollDirection;
12251
+ _previouslySortedColumn;
12280
12252
  set headerCells(cells) {
12253
+ // The header cells are rendered from headerColumnsCopy, so the elementRefs
12254
+ // have to be handed back to that same collection.
12281
12255
  const headerElements = cells.toArray();
12282
- for (let i = 0; i < headerElements.length; i++) {
12283
- this.columns[i].elementRef = headerElements[i];
12256
+ for (let i = 0; i < headerElements.length && i < this.headerColumnsCopy.length; i++) {
12257
+ this.headerColumnsCopy[i].elementRef = headerElements[i];
12284
12258
  }
12285
12259
  }
12286
12260
  rowElements;
@@ -12315,8 +12289,11 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12315
12289
  .then((index) => {
12316
12290
  this.editCellIndex = index;
12317
12291
  this.changeDetection.markForCheck();
12292
+ this._detectChanges();
12293
+ })
12294
+ .catch(() => {
12295
+ // row change was blocked by validation, keep the current cell in edit mode
12318
12296
  });
12319
- this._detectChanges();
12320
12297
  }
12321
12298
  if (event.code === 'Escape') {
12322
12299
  this.cancelEditRow();
@@ -12585,14 +12562,18 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12585
12562
  return obj !== col;
12586
12563
  });
12587
12564
  }
12588
- sortColumn(col, columnValue) {
12565
+ sortColumn(col, columnValue, preserveSortDirection) {
12589
12566
  col.isSelected = false;
12590
12567
  if (this.sortColumnValue === columnValue) {
12591
- this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
12568
+ if (!preserveSortDirection) {
12569
+ this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
12570
+ }
12592
12571
  }
12593
12572
  else {
12594
12573
  this.sortColumnValue = columnValue;
12595
- this.sortDirection = 'asc';
12574
+ if (!preserveSortDirection) {
12575
+ this.sortDirection = 'asc';
12576
+ }
12596
12577
  }
12597
12578
  const direction = this.sortDirection === 'asc' ? 1 : -1;
12598
12579
  const sorted = [...this.data].sort((a, b) => {
@@ -12621,9 +12602,15 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12621
12602
  }
12622
12603
  return (valA > valB ? 1 : valA < valB ? -1 : 0) * direction;
12623
12604
  });
12624
- this.data = sorted;
12605
+ this.setData(sorted);
12606
+ this._previouslySortedColumn = col;
12625
12607
  this._detectChanges();
12626
12608
  }
12609
+ repeatSortOnDataChange() {
12610
+ if (this._previouslySortedColumn) {
12611
+ this.sortColumn(this._previouslySortedColumn, this.sortColumnValue, true);
12612
+ }
12613
+ }
12627
12614
  showAllColumns() {
12628
12615
  this.isSettingsMenuOpen = false;
12629
12616
  this.headerColumnsCopy = this.headerColumns;
@@ -12719,6 +12706,9 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12719
12706
  }, 500);
12720
12707
  }
12721
12708
  /**
12709
+ * Cell indexes are expressed in `headerColumnsCopy` space, because that is the
12710
+ * collection the rows are rendered from. Using `columns` here would drift as soon
12711
+ * as a column is hidden or marked as single column.
12722
12712
  *
12723
12713
  * @param next; Move to next or previous cell
12724
12714
  * @param start; Start from cellindex
@@ -12726,9 +12716,16 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12726
12716
  */
12727
12717
  _nextAvailableCellToEdit(next, start = -1) {
12728
12718
  return new Promise((resolve, reject) => {
12729
- const numEditableColumns = this.columns.filter(c => !c.readonly).length;
12730
12719
  const wantedIndex = start + (next ? 1 : -1);
12731
- if (wantedIndex >= numEditableColumns) {
12720
+ const cellIndex = next
12721
+ ? this._getNextEditCellIndex(Math.max(wantedIndex, 0))
12722
+ : this._getPreviousEditCellIndex(wantedIndex);
12723
+ // Still an editable column left in the current row
12724
+ if (cellIndex > -1) {
12725
+ resolve(cellIndex);
12726
+ return;
12727
+ }
12728
+ if (next) {
12732
12729
  this._getNextEditRowIndex()
12733
12730
  .then((index) => {
12734
12731
  this.editRowIndex = index;
@@ -12738,34 +12735,37 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12738
12735
  reject();
12739
12736
  });
12740
12737
  }
12741
- else if (wantedIndex < 0) {
12738
+ else {
12742
12739
  this._getPreviousEditRowIndex()
12743
12740
  .then((index) => {
12744
12741
  this.editRowIndex = index;
12745
- resolve(this._getPreviousEditCellIndex(this.columns.length - 1));
12742
+ resolve(this._getPreviousEditCellIndex(this.headerColumnsCopy.length - 1));
12746
12743
  })
12747
12744
  .catch((e) => {
12748
12745
  reject();
12749
12746
  });
12750
12747
  }
12751
- else {
12752
- resolve(next ? this._getNextEditCellIndex(start + 1) : this._getPreviousEditCellIndex(start - 1));
12753
- }
12754
12748
  });
12755
12749
  }
12756
12750
  _getNextEditCellIndex(start) {
12757
- for (let i = start; i < this.columns.length; i++) {
12758
- if (!this.columns[i].readonly) {
12751
+ for (let i = start; i < this.headerColumnsCopy.length; i++) {
12752
+ if (this._isCellEditable(i)) {
12759
12753
  return i;
12760
12754
  }
12761
12755
  }
12756
+ return -1;
12762
12757
  }
12763
12758
  _getPreviousEditCellIndex(start) {
12764
- for (let i = start; i >= 0; i--) {
12765
- if (!this.columns[i].readonly) {
12759
+ for (let i = Math.min(start, this.headerColumnsCopy.length - 1); i >= 0; i--) {
12760
+ if (this._isCellEditable(i)) {
12766
12761
  return i;
12767
12762
  }
12768
12763
  }
12764
+ return -1;
12765
+ }
12766
+ _isCellEditable(cellIndex) {
12767
+ const column = this.headerColumnsCopy[cellIndex];
12768
+ return !!column && !column.readonly;
12769
12769
  }
12770
12770
  _getNextEditRowIndex() {
12771
12771
  return new Promise((resolve, reject) => {
@@ -14960,215 +14960,732 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
14960
14960
  }]
14961
14961
  }] });
14962
14962
 
14963
- class ListOfIconsComponent {
14964
- icons;
14965
- set collection(value) {
14966
- this._collection = value || [];
14967
- 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();
14968
14980
  }
14969
- get collection() {
14970
- return this._collection;
14981
+ get hostElement() {
14982
+ return this._hostElement;
14971
14983
  }
14972
- iconSize = 25;
14973
- activeItem;
14974
- itemSelected = new EventEmitter();
14984
+ toolTip;
14985
+ orientation = CoDirection.Up;
14986
+ tooltipClosed = new EventEmitter();
14975
14987
  showClass() {
14976
14988
  return true;
14977
14989
  }
14978
- Icon = CoreComponentsIcon;
14979
- showMenu = false;
14980
- showSubCategories = false;
14981
- _collection = [];
14982
- constructor(icons) {
14983
- this.icons = icons;
14990
+ top = -100;
14991
+ left = -100;
14992
+ get isTop() {
14993
+ return this._resolvedOrientation === CoDirection.Up;
14984
14994
  }
14985
- ngOnInit() {
14986
- if (this.activeItem === undefined) {
14987
- this.activeItem = this.collection[0];
14988
- }
14995
+ get isBottom() {
14996
+ return this._resolvedOrientation === CoDirection.Down;
14989
14997
  }
14990
- toggleMenu() {
14991
- this.showMenu = !this.showMenu;
14998
+ get isLeft() {
14999
+ return this._resolvedOrientation === CoDirection.Left;
14992
15000
  }
14993
- selectItem(item) {
14994
- if (item.children) {
14995
- 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) {
14996
15031
  return;
14997
15032
  }
14998
- this.activeItem = item;
14999
- this.showMenu = false;
15000
- 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();
15001
15044
  }
15002
- handlePickingCategoryClicked(subCategory) {
15003
- this.activeItem = subCategory;
15004
- this.showMenu = false;
15005
- this.itemSelected.emit(subCategory);
15006
- 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
+ }
15007
15071
  }
15008
- onClickOutside() {
15009
- this.showMenu = false;
15010
- 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
+ }
15011
15083
  }
15012
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsComponent, deps: [{ token: IconCacheService }], target: i0.ɵɵFactoryTarget.Component });
15013
- 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: `
15014
- <div class="icon-item active" [class.menu-opened]="showMenu" (click)="toggleMenu()">
15015
- <co-icon [iconData]="activeItem.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15016
- @if (!showMenu) {
15017
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
15018
- }
15019
- @if (showMenu) {
15020
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15021
- }
15022
- </div>
15023
- @if (showMenu) {
15024
- <div class="dropdown-menu" (clickOutside)="onClickOutside()">
15025
- @for (item of collection; track item) {
15026
- <div
15027
- class="icon-item"
15028
- [class.active]="item === activeItem"
15029
- (click)="selectItem(item)">
15030
- <co-icon [iconData]="item.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15031
- <div class="label" [textContent]="item.label | coreLocalize"></div>
15032
- @if (showSubCategories && item.children?.length > 0) {
15033
- <div class="picking-type-wrapper">
15034
- @for (subCategory of item.children; track subCategory) {
15035
- <div
15036
- class="button-wrapper"
15037
- (click)="handlePickingCategoryClicked(subCategory)">
15038
- <co-icon
15039
- class="co-transaction-button-bar-icon"
15040
- [iconData]="subCategory.icon"
15041
- [style.width.px]="iconSize"
15042
- [style.height.px]="iconSize">
15043
- </co-icon>
15044
- <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15045
- </div>
15046
- }
15047
- </div>
15048
- }
15049
- </div>
15050
- }
15051
- </div>
15052
- }
15053
- `, 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 });
15054
15133
  }
15055
- 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: [{
15056
15135
  type: Component,
15057
15136
  args: [{
15058
- selector: 'co-list-of-icons',
15137
+ selector: 'co-tooltip',
15059
15138
  template: `
15060
- <div class="icon-item active" [class.menu-opened]="showMenu" (click)="toggleMenu()">
15061
- <co-icon [iconData]="activeItem.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15062
- @if (!showMenu) {
15063
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretDownSolid)"></co-icon>
15064
- }
15065
- @if (showMenu) {
15066
- <co-icon class="drop-arrow" [iconData]="icons.getIcon(Icon.CaretUpSolid)"></co-icon>
15067
- }
15068
- </div>
15069
- @if (showMenu) {
15070
- <div class="dropdown-menu" (clickOutside)="onClickOutside()">
15071
- @for (item of collection; track item) {
15072
- <div
15073
- class="icon-item"
15074
- [class.active]="item === activeItem"
15075
- (click)="selectItem(item)">
15076
- <co-icon [iconData]="item.icon" [style.width.px]="iconSize" [style.height.px]="iconSize"></co-icon>
15077
- <div class="label" [textContent]="item.label | coreLocalize"></div>
15078
- @if (showSubCategories && item.children?.length > 0) {
15079
- <div class="picking-type-wrapper">
15080
- @for (subCategory of item.children; track subCategory) {
15081
- <div
15082
- class="button-wrapper"
15083
- (click)="handlePickingCategoryClicked(subCategory)">
15084
- <co-icon
15085
- class="co-transaction-button-bar-icon"
15086
- [iconData]="subCategory.icon"
15087
- [style.width.px]="iconSize"
15088
- [style.height.px]="iconSize">
15089
- </co-icon>
15090
- <span class="button-title" [textContent]="subCategory.label | coreLocalize"></span>
15091
- </div>
15092
- }
15093
- </div>
15094
- }
15095
- </div>
15096
- }
15097
- </div>
15098
- }
15099
- `,
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,
15100
15149
  encapsulation: ViewEncapsulation.None,
15101
15150
  standalone: false
15102
15151
  }]
15103
- }], ctorParameters: () => [{ type: IconCacheService }], propDecorators: { collection: [{
15152
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }], propDecorators: { hostElement: [{
15104
15153
  type: Input
15105
- }], iconSize: [{
15154
+ }], toolTip: [{
15106
15155
  type: Input
15107
- }], activeItem: [{
15156
+ }], orientation: [{
15108
15157
  type: Input
15109
- }], itemSelected: [{
15158
+ }], tooltipClosed: [{
15110
15159
  type: Output
15111
15160
  }], showClass: [{
15112
15161
  type: HostBinding,
15113
- 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']
15114
15184
  }] } });
15115
15185
 
15116
- class ListOfIconsModule {
15117
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15118
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, declarations: [ListOfIconsComponent], imports: [CommonModule,
15119
- FormsModule,
15120
- IconModule,
15121
- ClickoutsideModule,
15122
- CoreComponentsTranslationModule], exports: [ListOfIconsComponent] });
15123
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, imports: [CommonModule,
15124
- FormsModule,
15125
- IconModule,
15126
- ClickoutsideModule,
15127
- CoreComponentsTranslationModule] });
15128
- }
15129
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfIconsModule, decorators: [{
15130
- type: NgModule,
15131
- args: [{
15132
- imports: [
15133
- CommonModule,
15134
- FormsModule,
15135
- IconModule,
15136
- ClickoutsideModule,
15137
- CoreComponentsTranslationModule
15138
- ],
15139
- declarations: [
15140
- ListOfIconsComponent
15141
- ],
15142
- exports: [
15143
- ListOfIconsComponent
15144
- ]
15145
- }]
15146
- }] });
15147
-
15148
- class ResponsiveTextComponent {
15149
- text;
15150
- showClass() {
15151
- return true;
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;
15152
15197
  }
15153
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15154
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: ResponsiveTextComponent, isStandalone: false, selector: "co-responsive-text", inputs: { text: "text" }, host: { properties: { "class.co-responsive-text": "this.showClass" } }, ngImport: i0, template: `
15155
- <svg viewBox="0 0 100 100">
15156
- <foreignObject height="100%" width="100%">
15157
- <div class="text" [textContent]="text"></div>
15158
- </foreignObject>
15159
- </svg>
15160
- `, isInline: true, encapsulation: i0.ViewEncapsulation.None });
15161
- }
15162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveTextComponent, decorators: [{
15163
- type: Component,
15164
- args: [{
15165
- selector: 'co-responsive-text',
15166
- template: `
15167
- <svg viewBox="0 0 100 100">
15168
- <foreignObject height="100%" width="100%">
15169
- <div class="text" [textContent]="text"></div>
15170
- </foreignObject>
15171
- </svg>
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 });
15307
+ }
15308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, decorators: [{
15309
+ type: Directive,
15310
+ args: [{
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
15595
+ ],
15596
+ declarations: [
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
15658
+ ],
15659
+ exports: [
15660
+ ListOfIconsComponent
15661
+ ]
15662
+ }]
15663
+ }] });
15664
+
15665
+ class ResponsiveTextComponent {
15666
+ text;
15667
+ showClass() {
15668
+ return true;
15669
+ }
15670
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15671
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: ResponsiveTextComponent, isStandalone: false, selector: "co-responsive-text", inputs: { text: "text" }, host: { properties: { "class.co-responsive-text": "this.showClass" } }, ngImport: i0, template: `
15672
+ <svg viewBox="0 0 100 100">
15673
+ <foreignObject height="100%" width="100%">
15674
+ <div class="text" [textContent]="text"></div>
15675
+ </foreignObject>
15676
+ </svg>
15677
+ `, isInline: true, encapsulation: i0.ViewEncapsulation.None });
15678
+ }
15679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ResponsiveTextComponent, decorators: [{
15680
+ type: Component,
15681
+ args: [{
15682
+ selector: 'co-responsive-text',
15683
+ template: `
15684
+ <svg viewBox="0 0 100 100">
15685
+ <foreignObject height="100%" width="100%">
15686
+ <div class="text" [textContent]="text"></div>
15687
+ </foreignObject>
15688
+ </svg>
15172
15689
  `,
15173
15690
  encapsulation: ViewEncapsulation.None,
15174
15691
  standalone: false
@@ -18146,242 +18663,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
18146
18663
  }]
18147
18664
  }] });
18148
18665
 
18149
- class TooltipComponent {
18150
- _elementRef;
18151
- _changeDetector;
18152
- _renderer;
18153
- set hostElement(value) {
18154
- this._hostElement = value;
18155
- // this._positionTooltip();
18156
- }
18157
- get hostElement() {
18158
- return this._hostElement;
18159
- }
18160
- toolTip;
18161
- tooltipClosed = new EventEmitter();
18162
- showClass() {
18163
- return true;
18164
- }
18165
- top = -100;
18166
- left = -100;
18167
- bottom = false;
18168
- animate = true;
18169
- _hostElement;
18170
- _documentClickListener;
18171
- constructor(_elementRef, _changeDetector, _renderer) {
18172
- this._elementRef = _elementRef;
18173
- this._changeDetector = _changeDetector;
18174
- this._renderer = _renderer;
18175
- }
18176
- ngAfterViewInit() {
18177
- setTimeout(() => {
18178
- this._positionTooltip();
18179
- });
18180
- this._documentClickListener = this._renderer.listen('document', 'click', (event) => {
18181
- if (!this._elementRef.nativeElement.contains(event.target)) {
18182
- this.closeTooltip();
18183
- }
18184
- });
18185
- }
18186
- ngOnDestroy() {
18187
- // Remove the click listener to prevent memory leaks
18188
- if (this._documentClickListener) {
18189
- this._documentClickListener();
18190
- }
18191
- }
18192
- _positionTooltip() {
18193
- if (this.hostElement && this._elementRef && this._elementRef.nativeElement) {
18194
- const rect = this.hostElement.getBoundingClientRect();
18195
- const ownRect = this._elementRef.nativeElement.getBoundingClientRect();
18196
- let wantedLeft = rect.left;
18197
- let wantedTop = rect.top - ownRect.height;
18198
- if (wantedTop < 0) { // out of view, move to bottom
18199
- this.bottom = true;
18200
- wantedTop = rect.bottom;
18201
- }
18202
- else {
18203
- this.bottom = false;
18204
- }
18205
- this.left = wantedLeft;
18206
- this.top = wantedTop;
18207
- this._changeDetector.markForCheck();
18208
- this._changeDetector.detectChanges();
18209
- }
18210
- }
18211
- closeTooltip() {
18212
- this.tooltipClosed.emit();
18213
- }
18214
- 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 });
18215
- 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: `
18216
- <div class="tooltip" [innerHTML]="toolTip"></div>
18217
- `, isInline: true, animations: [
18218
- trigger("showHide", [
18219
- state("void", style({ opacity: 0 })),
18220
- state("*", style({ opacity: 1 })),
18221
- transition("void <=> *", animate("200ms ease-in-out")),
18222
- ])
18223
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
18224
- }
18225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipComponent, decorators: [{
18226
- type: Component,
18227
- args: [{
18228
- selector: 'co-tooltip',
18229
- template: `
18230
- <div class="tooltip" [innerHTML]="toolTip"></div>
18231
- `,
18232
- animations: [
18233
- trigger("showHide", [
18234
- state("void", style({ opacity: 0 })),
18235
- state("*", style({ opacity: 1 })),
18236
- transition("void <=> *", animate("200ms ease-in-out")),
18237
- ])
18238
- ],
18239
- changeDetection: ChangeDetectionStrategy.OnPush,
18240
- encapsulation: ViewEncapsulation.None,
18241
- standalone: false
18242
- }]
18243
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }], propDecorators: { hostElement: [{
18244
- type: Input
18245
- }], toolTip: [{
18246
- type: Input
18247
- }], tooltipClosed: [{
18248
- type: Output
18249
- }], showClass: [{
18250
- type: HostBinding,
18251
- args: ['class.co-tooltip']
18252
- }], top: [{
18253
- type: HostBinding,
18254
- args: ["style.top.px"]
18255
- }], left: [{
18256
- type: HostBinding,
18257
- args: ["style.left.px"]
18258
- }], bottom: [{
18259
- type: HostBinding,
18260
- args: ["class.bottom"]
18261
- }], animate: [{
18262
- type: HostBinding,
18263
- args: ['@showHide']
18264
- }] } });
18265
-
18266
- class TooltipDirective {
18267
- _compFactoryResolver;
18268
- _appRef;
18269
- _injector;
18270
- _sanitizer;
18271
- set tooltip(str) {
18272
- this._tooltipMessage = str;
18273
- }
18274
- _elementRef;
18275
- _tooltipMessage;
18276
- _componentRef;
18277
- constructor(elementRef, _compFactoryResolver, _appRef, _injector, _sanitizer) {
18278
- this._compFactoryResolver = _compFactoryResolver;
18279
- this._appRef = _appRef;
18280
- this._injector = _injector;
18281
- this._sanitizer = _sanitizer;
18282
- this._elementRef = elementRef;
18283
- }
18284
- ngOnDestroy() {
18285
- if (this._elementRef && this._elementRef.nativeElement) {
18286
- this._elementRef.nativeElement.removeEventListener('mouseenter', (event) => this._handleMouseMove(event));
18287
- this._elementRef.nativeElement.removeEventListener('mouseleave', () => this._removeTooltip());
18288
- }
18289
- window.removeEventListener("scroll", (event) => this._handleScroll);
18290
- this._elementRef = undefined;
18291
- }
18292
- ngOnInit() {
18293
- window.addEventListener("scroll", (event) => this._handleScroll);
18294
- if (this._elementRef && this._elementRef.nativeElement) {
18295
- this._elementRef.nativeElement.addEventListener('mouseenter', (event) => this._handleMouseMove(event));
18296
- this._elementRef.nativeElement.addEventListener('mouseleave', () => this._removeTooltip());
18297
- }
18298
- }
18299
- _handleScroll() {
18300
- this._removeTooltip();
18301
- }
18302
- _handleMouseMove(event) {
18303
- this._showTooltip(event.clientY, event.clientX);
18304
- }
18305
- _showTooltip(top, left) {
18306
- this._createTooltipComponent(top, left);
18307
- }
18308
- _removeTooltip() {
18309
- if (this._componentRef) {
18310
- this._appRef.detachView(this._componentRef.hostView);
18311
- this._componentRef.destroy();
18312
- this._componentRef = undefined;
18313
- }
18314
- }
18315
- _createTooltipComponent(top, left) {
18316
- if (!this._tooltipMessage) {
18317
- return;
18318
- }
18319
- if (this._componentRef) {
18320
- return;
18321
- }
18322
- this._componentRef = this._compFactoryResolver
18323
- .resolveComponentFactory(TooltipComponent)
18324
- .create(this._injector);
18325
- this._componentRef.instance.hostElement = this._elementRef.nativeElement;
18326
- this._componentRef.instance.toolTip = this._sanitizer.bypassSecurityTrustHtml(this._tooltipMessage);
18327
- this._appRef.attachView(this._componentRef.hostView);
18328
- const domElem = this._componentRef.hostView.rootNodes[0];
18329
- document.body.appendChild(domElem);
18330
- }
18331
- 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 });
18332
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: TooltipDirective, isStandalone: false, selector: "[tooltip]", inputs: { tooltip: "tooltip" }, ngImport: i0 });
18333
- }
18334
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirective, decorators: [{
18335
- type: Directive,
18336
- args: [{
18337
- selector: "[tooltip]",
18338
- standalone: false
18339
- }]
18340
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }, { type: i0.Injector }, { type: i1.DomSanitizer }], propDecorators: { tooltip: [{
18341
- type: Input,
18342
- args: ["tooltip"]
18343
- }] } });
18344
-
18345
- class TooltipModule {
18346
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18347
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, declarations: [TooltipComponent], imports: [CommonModule], exports: [TooltipComponent] });
18348
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, imports: [CommonModule] });
18349
- }
18350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipModule, decorators: [{
18351
- type: NgModule,
18352
- args: [{
18353
- imports: [
18354
- CommonModule
18355
- ],
18356
- declarations: [
18357
- TooltipComponent
18358
- ],
18359
- exports: [
18360
- TooltipComponent
18361
- ]
18362
- }]
18363
- }] });
18364
-
18365
- class TooltipDirectiveModule {
18366
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
18367
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, declarations: [TooltipDirective], imports: [TooltipModule], exports: [TooltipDirective] });
18368
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, imports: [TooltipModule] });
18369
- }
18370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TooltipDirectiveModule, decorators: [{
18371
- type: NgModule,
18372
- args: [{
18373
- imports: [
18374
- TooltipModule
18375
- ],
18376
- declarations: [
18377
- TooltipDirective
18378
- ],
18379
- exports: [
18380
- TooltipDirective
18381
- ]
18382
- }]
18383
- }] });
18384
-
18385
18666
  // Base screen configuration service for one "screen module", e.g. 'Crm'. Db-loads, stores and and interprets ObjectConfiguration config objects.
18386
18667
  class BaseModuleScreenConfigService {
18387
18668
  // emits the params of the loaded config, each time when a new config was loaded