src/ui/icon-picker/icon-selection-popup/icon-selection-popup.component.ts
| changeDetection | ChangeDetectionStrategy.Eager |
| host | { |
| selector | smart-icon-selection-popup |
| styleUrls | ./icon-selection-popup.component.scss |
| templateUrl | ./icon-selection-popup.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
constructor(changeDetectorRef: ChangeDetectorRef)
|
||||||
|
Parameters :
|
| anchor |
Type : HTMLElement
|
| selectedIcon |
Type : string
|
Default value : ''
|
| iconSelected |
Type : EventEmitter<string>
|
| document:click |
Arguments : '$event'
|
document:click(event: Event)
|
| document:keydown |
Arguments : '$event'
|
document:keydown(event: KeyboardEvent)
|
| closePopup |
closePopup()
|
|
Returns :
void
|
| Public documentClick | ||||||
documentClick(event: Event)
|
||||||
Decorators :
@HostListener('document:click', ['$event'])
|
||||||
|
Parameters :
Returns :
void
|
| Public keydown | ||||||
keydown(event: KeyboardEvent)
|
||||||
Decorators :
@HostListener('document:keydown', ['$event'])
|
||||||
|
Parameters :
Returns :
void
|
| onIconFilterChange | ||||||
onIconFilterChange(searchIcon: string)
|
||||||
|
Parameters :
Returns :
void
|
| onIconSelected | ||||||
onIconSelected(icon: string)
|
||||||
|
Parameters :
Returns :
void
|
| populateFAIcons |
populateFAIcons()
|
|
Returns :
void
|
| allFAIcons |
Type : string[]
|
Default value : []
|
| Readonly defaultPopupWidth |
Type : number
|
Default value : 240
|
| faIcons |
Type : string[]
|
Default value : []
|
| onSearchIconChange |
Type : unknown
|
Default value : _.debounce((value: string) => {
this.selectedIcon = value;
this.onIconFilterChange(value);
}, 200)
|
| Public popup |
Type : ElementRef
|
Decorators :
@ViewChild('popup', {read: ElementRef})
|
| searchIcon |
Type : string
|
Default value : ''
|
| popupWidth |
getpopupWidth()
|
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") - *
* www.consultingwerk.com and other contributors as listed *
* below. All Rights Reserved. *
* *
* Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY *
* KIND, either express or implied. *
* *
* Contributors: *
* *
**************************************************************************
--------------------------------------------------------------------------
File : icon-selection-popup.component.html
Purpose : Template for icon selection popup.
Author(s) : Oana Sucigan
Created : Jun 02, 2025
--------------------------------------------------------------------------
-->
<kendo-popup
#popup
class="icon-selection-popup"
[anchor]="anchor"
[positionMode]="'absolute'"
[animate]="false"
>
<div
class="content"
[style.width.px]="popupWidth"
[style.minWidth.px]="popupWidth"
>
<div class="d-flex flex-column">
<div class="icons-container p-2">
<div class="icons-filter w-100 py-2">
<kendo-textbox
class="w-100"
[clearButton]="true"
[placeholder]="'Search icons...'"
[ngModel]="searchIcon"
(ngModelChange)="onSearchIconChange($event)"
></kendo-textbox>
</div>
<div class="icons-list">
@for (icon of faIcons; track icon) {
<kendo-card
width="150px"
height="100px"
(click)="onIconSelected(icon)"
>
<kendo-card-body>
<i [class]="icon"></i>
</kendo-card-body>
<kendo-card-footer>
<span class="icon-name">{{
icon.split(' ')[1].split('fa-')[1]
}}</span>
</kendo-card-footer>
</kendo-card>
}
</div>
</div>
</div>
</div>
</kendo-popup>
./icon-selection-popup.component.scss
/**********************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") - *
* www.consultingwerk.com and other contributors as listed *
* below. All Rights Reserved. *
* *
* Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY *
* KIND, either express or implied. *
* *
* Contributors: *
* *
**********************************************************************/
/*------------------------------------------------------------------------
File : icon-selection-popup.component.scss
Purpose : Styles for icon selection popup.
Author(s) : Oana Sucigan
Created : Jun 02, 2025
----------------------------------------------------------------------*/
.icons-filter {
}
.icons-container {
display: flex;
width: 100%;
max-height: 300px;
flex-direction: column;
}
.icons-filter {
flex: 0;
}
.icons-list {
display: flex;
flex-wrap: wrap;
width: 100%;
overflow-y: scroll;
gap:10px;
flex: 1;
}
.k-card {
cursor: pointer;
.k-card-body {
text-align: center;
}
.k-card-footer {
text-align: center;
}
&:hover {
background-color: #f0f0f0;
}
}
i {
text-align: center;
font-size: calc(1em * 2);
font-weight: 900;
}
span.icon-name {
text-align: center;
margin-top: 1em * 1.5;
padding: 0px;
font-size: calc(1em * 0.9);
}