src/ui/icon-picker/smart-icon-picker.component.ts
AbstractSmartViewerFieldComponent
| changeDetection | ChangeDetectionStrategy.Eager |
| providers |
)
}
|
| selector | smart-icon-picker |
| styleUrls | ./smart-icon-picker.component.scss |
| templateUrl | ./smart-icon-picker.component.html |
Properties |
Methods |
Inputs |
Outputs |
Accessors |
constructor(serviceAdapter: SmartServiceAdapter, changeDetector: ChangeDetectorRef, elementRef: ElementRef, zone: NgZone, document: Document, domSanitizer: DomSanitizer, viewContainerRef: ViewContainerRef)
|
||||||||||||||||||||||||
|
Parameters :
|
| disabled |
Type : boolean
|
| filePickerOptions |
Type : any
|
Default value : {
selectionMode: 'file',
folderScope: 'sfrboimages',
allowCreateFolder: false,
allowCustomFileNames: false
}
|
| name |
Type : string
|
| selected |
Type : any
|
|
Selected record on the datasource |
| smart-help-url |
Type : string
|
| smartModel |
Type : string
|
| visible |
Type : boolean
|
Default value : true
|
| editorButtons |
Type : EditorButton[]
|
Default value : []
|
| smart-viewer-unbound-field |
Type : boolean
|
| smart-instance-name |
Type : string
|
|
The instance name of the component |
| smart-object-name |
Type : string
|
|
The object name of the component |
| blur |
Type : EventEmitter<void>
|
| focus |
Type : EventEmitter<void>
|
| smartModelChange |
Type : EventEmitter<any>
|
| onEditorButtonClicked |
Type : EditorButton
|
| callNativeMethod | |||||||||
callNativeMethod(methodName: string, args: any[])
|
|||||||||
|
Parameters :
Returns :
any
|
| getNativeProperty | ||||||
getNativeProperty(propertyName: string)
|
||||||
|
Parameters :
Returns :
any
|
| handleTouched |
handleTouched()
|
|
Returns :
void
|
| onDropdownClose |
onDropdownClose()
|
|
Returns :
void
|
| onDropdownOpen |
onDropdownOpen()
|
|
Returns :
void
|
| onIconSelected | ||||||
onIconSelected(icon: string)
|
||||||
|
Parameters :
Returns :
void
|
| onPickerOptionChanged | ||||||
onPickerOptionChanged(event: any)
|
||||||
|
Parameters :
Returns :
void
|
| openIconPicker | ||||||
openIconPicker(event?: MouseEvent)
|
||||||
|
Parameters :
Returns :
void
|
| registerOnChange | ||||||
registerOnChange(fn: any)
|
||||||
|
Parameters :
Returns :
void
|
| registerOnTouched | ||||||
registerOnTouched(fn: any)
|
||||||
|
Parameters :
Returns :
void
|
| Optional setDisabledState | ||||||
setDisabledState(isDisabled: boolean)
|
||||||
|
Parameters :
Returns :
void
|
| setNativeProperty |
setNativeProperty(propertyName: string, value: any)
|
|
Returns :
void
|
| writeValue | ||||||
writeValue(obj: any)
|
||||||
|
Parameters :
Returns :
void
|
| imageUrl |
Type : SafeResourceUrl | null
|
| inputEl |
Type : ElementRef
|
Decorators :
@ViewChild('vTextField', {read: ElementRef})
|
| isIcon |
Type : boolean
|
Default value : false
|
| onValueChanged |
Type : unknown
|
Default value : _.debounce((value: string) => {
this.selectedIcon = value;
this.computeIconOrImage();
this.smartModelChange.emit(value);
this.onChange?.(value);
}, 800)
|
| pickerOptions |
Type : ListItemModel[]
|
Default value : [
{
text: 'Font Awesome Icon',
iconClass: 'fa-solid fa-icons'
},
{
text: 'Image',
iconClass: 'fa-solid fa-image'
}
]
|
| selectedIcon |
Type : string
|
Default value : ''
|
| showPopup |
Type : boolean
|
Default value : false
|
| smartModel | ||||||
getsmartModel()
|
||||||
setsmartModel(value: string)
|
||||||
|
Parameters :
Returns :
void
|
| selected | ||||||
getselected()
|
||||||
|
Selected record on the datasource |
||||||
setselected(value: any)
|
||||||
|
Selected record on the datasource
Parameters :
Returns :
void
|
| helpUrl | ||||||
gethelpUrl()
|
||||||
|
Returns :
string
|
||||||
sethelpUrl(value: string)
|
||||||
|
Parameters :
Returns :
void
|
| disabled | ||||||
getdisabled()
|
||||||
setdisabled(val: boolean)
|
||||||
|
Parameters :
Returns :
void
|
| popupAppendTarget |
getpopupAppendTarget()
|
<!--
**************************************************************************
* 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 : smart-icon-picker.component.html
Purpose : Template for Smart Icon Picker.
Author(s) : Oana Sucigan
Created : May 30, 2025
--------------------------------------------------------------------------
-->
<div class="input-group icon-picker-input-group" [ngClass]="{ 'd-none': visible === false }">
@if (isIcon) {
<kendo-textbox
#vTextField
class="form-field-input form-control"
[disabled]="disabled"
(ngModelChange)="onValueChanged($event)"
[ngModel]="selectedIcon"
[readonly]="true"
(blur)="handleTouched()"
(focus)="handleTouched()"
[clearButton]="true"
>
<ng-template kendoTextBoxPrefixTemplate>
<div class="icon-container">
@if (selectedIcon) {
<i [ngClass]="selectedIcon"></i>
}
</div>
</ng-template>
<ng-template kendoTextBoxSuffixTemplate>
<button kendoButton fillMode="flat" themeColor="base" (click)="openIconPicker()" iconClass="fa-solid fa-icons" class="smart-input-button">
</button>
@for (button of editorButtons(); track button.key) {
<button
kendoButton
fill="clear"
[disabled]="disabled"
[iconClass]="button.icon"
[smartEditorButton]="button"
(editorButtonClicked)="onEditorButtonClicked.emit($event)">
{{ button.label }}
</button>
}
</ng-template>
</kendo-textbox>
}
@else {
<smart-file-picker
class="form-field-input form-control file-picker"
folderScope="sfrboImages"
[ngModel]="selectedIcon"
(ngModelChange)="onValueChanged($event)"
selectionMode="file"
[disabled]="disabled"
[visible]="visible"
(blur)="handleTouched()"
(focus)="handleTouched()"
[folderScope]="filePickerOptions.folderScope"
[selectionMode]="filePickerOptions.selectionMode"
[fileMustExist]="!filePickerOptions.allowCustomFileNames"
[allowCreateFolder]="filePickerOptions.allowCreateFolder"
[editorButtons]="editorButtons()"
(onEditorButtonClicked)="onEditorButtonClicked.emit($event)"
></smart-file-picker>
}
<div class="input-group-append picker-option-btn-wrap">
<kendo-dropdownbutton
[data]="pickerOptions"
[disabled]="disabled"
[ngClass]="{'picker-option-btn': true, 'k-disabled': disabled}"
iconClass="fa-solid fa-caret-down"
(itemClick)="onPickerOptionChanged($event)"
(open)="onDropdownOpen()"
(close)="onDropdownClose()"
[popupSettings]="{ popupClass: 'picker-option-popup', appendTo: popupAppendTarget }"
></kendo-dropdownbutton>
</div>
</div>
./smart-icon-picker.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 : smart-icon-picker.component.scss
Purpose : Styles for Smart Icon Picker.
Author(s) : Oana Sucigan
Created : Apr 17, 2025
----------------------------------------------------------------------*/
.input-group {
display: flex;
flex-direction: row;
.form-field-input {
flex: 1;
}
.input-group-append {
flex: 0;
}
smart-file-picker {
padding: 0px;
height: auto;
}
}
.icon-container {
height: 100%;
width: 20px;
}
.icon-picker-prefix {
max-height: 100%;
width: auto;
min-width: 16px;
}
.icon-picker-input-group {
flex-wrap: nowrap;
}
.search-btn-wrap .k-button {
height: 100%;
}
.picker-option-btn-wrap .picker-option-btn {
height: 100%;
padding: 0px;
.k-button {
.k-button-icon {
min-height: unset;
}
}
}
.k-textbox input {
width: 100% !important;
border-right: 0 transparent !important;
}