File

src/ui/image-textbox/smart-image-textbox.component.ts

Extends

AbstractSmartViewerFieldComponent

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

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

Inputs

name
Type : string
selected
Type : any

Selected record on the datasource

smart-help-url
Type : string
smartModel
Type : string
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
setNativeProperty
setNativeProperty(propertyName: string, value: any)
Parameters :
Name Type Optional
propertyName string No
value any No
Returns : void

Properties

disabled
Type : boolean
imageUrl
Type : SafeResourceUrl | null
onValueChanged
Type : unknown
Default value : _.debounce((value) => { this.selectedImage = value; this.smartModelChange.emit(value); this.computeImageURL(); }, 800)
selectedImage
Type : string
visible
Type : boolean

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
<!--
**************************************************************************
* 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-image-textbox.component.html
    Purpose     : Template for Smart Image Textbox.
    Author(s)   : Oana Sucigan
    Created     : Apr 17, 2025
--------------------------------------------------------------------------
-->
<kendo-textbox
	#vTextField
	class="form-field-input smart-image-textbox"
	[disabled]="disabled"
	[ngModel]="selectedImage"
	(ngModelChange)="onValueChanged($event)"
	(blur)="blur.next()"
	(focus)="focus.next()"
>
	<ng-template kendoTextBoxPrefixTemplate>
		<div class="image-container">
			@if (selectedImage) {
			<img
				#image
				[src]="imageUrl"
				onload="this.classList = 'textbox-prefix-image image-found'; return true;"
				onerror="this.classList = 'textbox-prefix-image image-not-found'; return true;"
			/>
			}

			<div class="placeholder-image">
				<i class="fa-regular fa-image"></i>
				<i class="fa-solid fa-slash"></i>
			</div>
		</div>
	</ng-template>

	<ng-template kendoTextBoxSuffixTemplate>
		@for (button of editorButtons(); track button.key) {
		<button
			kendoButton
			[iconClass]="button.icon"
			[smartEditorButton]="button"
			(editorButtonClicked)="onEditorButtonClicked.emit($event)"
		>
			{{ button.label }}
		</button>
		}
	</ng-template>
</kendo-textbox>

./smart-image-textbox.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-image-textbox.component.scss
    Purpose     : Styles for Smart Image Textbox.
    Author(s)   : Oana Sucigan
    Created     : Apr 17, 2025
  ----------------------------------------------------------------------*/

.image-container {
    height: 100%;
    width: 28px;
}

img.textbox-prefix-image {
    max-height: 100%;
    width: auto;
    min-width: var(--kendo-spacing-4, 1rem);
}
img.image-found {
    display: block;
}
img.image-not-found {
    display: none;
}

img.textbox-prefix-image.image-not-found + .placeholder-image {
    display: block;
}
img.textbox-prefix-image.image-found + .placeholder-image {
    display: none;
}

.placeholder-image {
    max-height: 100%;
    position: relative;
    height: 100%;
    width: 100%;
}

.placeholder-image i {
    position: absolute;
}

.placeholder-image i.fa-image {
    font-size: var(--kendo-font-size-sm, 0.875rem);
    margin: var(--kendo-spacing-#{0.5}, 0.125rem) var(--kendo-spacing-1, 0.25rem);
}
.placeholder-image i.fa-slash {
    font-size: var(--kendo-font-size-md, 1rem);

    -moz-transform: scaleY(-1);
    -o-transform: scaleY(-1);
    -webkit-transform: scaleY(-1);
    transform: scaleY(-1);
    filter: FlipV;
    -ms-filter: "FlipV";
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""