File

src/ui/icon-picker/smart-icon-picker.component.ts

Extends

AbstractSmartViewerFieldComponent

Implements

ControlValueAccessor OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(serviceAdapter: SmartServiceAdapter, changeDetector: ChangeDetectorRef, elementRef: ElementRef, zone: NgZone, document: Document, domSanitizer: DomSanitizer, viewContainerRef: ViewContainerRef)
Parameters :
Name Type Optional
serviceAdapter SmartServiceAdapter No
changeDetector ChangeDetectorRef No
elementRef ElementRef No
zone NgZone No
document Document No
domSanitizer DomSanitizer No
viewContainerRef ViewContainerRef No

Inputs

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

Outputs

blur
Type : EventEmitter<void>
focus
Type : EventEmitter<void>
smartModelChange
Type : EventEmitter<any>
onEditorButtonClicked
Type : EditorButton

Methods

callNativeMethod
callNativeMethod(methodName: string, args: any[])
Parameters :
Name Type Optional
methodName string No
args any[] No
Returns : any
getNativeProperty
getNativeProperty(propertyName: string)
Parameters :
Name Type Optional
propertyName string No
Returns : any
handleTouched
handleTouched()
Returns : void
onDropdownClose
onDropdownClose()
Returns : void
onDropdownOpen
onDropdownOpen()
Returns : void
onIconSelected
onIconSelected(icon: string)
Parameters :
Name Type Optional
icon string No
Returns : void
onPickerOptionChanged
onPickerOptionChanged(event: any)
Parameters :
Name Type Optional
event any No
Returns : void
openIconPicker
openIconPicker(event?: MouseEvent)
Parameters :
Name Type Optional
event MouseEvent Yes
Returns : void
registerOnChange
registerOnChange(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
registerOnTouched
registerOnTouched(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
Optional setDisabledState
setDisabledState(isDisabled: boolean)
Parameters :
Name Type Optional
isDisabled boolean No
Returns : void
setNativeProperty
setNativeProperty(propertyName: string, value: any)
Parameters :
Name Type Optional
propertyName string No
value any No
Returns : void
writeValue
writeValue(obj: any)
Parameters :
Name Type Optional
obj any No
Returns : void

Properties

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

Accessors

smartModel
getsmartModel()
setsmartModel(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
selected
getselected()

Selected record on the datasource

setselected(value: any)

Selected record on the datasource

Parameters :
Name Type Optional
value any No
Returns : void
helpUrl
gethelpUrl()
Returns : string
sethelpUrl(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
disabled
getdisabled()
setdisabled(val: boolean)
Parameters :
Name Type Optional
val boolean No
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;
}

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""