File

src/ui/viewer/components/field/field.component.ts

Implements

OnInit AfterViewInit OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(helperService: SmartViewerHelperService<AbstractFrameComponent>, formInstanceService: SmartFormInstanceService, serviceAdapter: SmartServiceAdapter, globalValues: SmartGlobalValueStoreService, element: ElementRef, renderer: Renderer2, smartConfig: SmartConfig, domSanitizer: DomSanitizer, smartServiceAdapter: SmartServiceAdapter, changeDetector: ChangeDetectorRef, injector: Injector, zone: NgZone)
Parameters :
Name Type Optional
helperService SmartViewerHelperService<AbstractFrameComponent> No
formInstanceService SmartFormInstanceService No
serviceAdapter SmartServiceAdapter No
globalValues SmartGlobalValueStoreService No
element ElementRef No
renderer Renderer2 No
smartConfig SmartConfig No
domSanitizer DomSanitizer No
smartServiceAdapter SmartServiceAdapter No
changeDetector ChangeDetectorRef No
injector Injector No
zone NgZone No

Inputs

field
Type : SmartViewerFieldSettings

Sets the field settings.

hasAbsolutePosition
Type : boolean

Sets whether the field uses absolute positioning.

inline-label
Type : boolean

Sets the inline label flag.

smart-help-url
Type : string

Outputs

componentRendered$
Type : ReplaySubject<void>

Methods

computeStyling
computeStyling(style: any)

Computes and applies the styling for the field component.

Parameters :
Name Type Optional Description
style any No
  • The style object containing CSS properties and values.
Returns : void
createFieldComponent
createFieldComponent()

Creates and initializes the field component based on the field type and input settings.

Returns : void
getLabelStyle
getLabelStyle(label: HTMLElement)

Computes and returns the style for the label element.

Parameters :
Name Type Optional Description
label HTMLElement No
  • The label element for which to compute the style.
Returns : any

The computed style for the label element.

setLabelStyle
setLabelStyle()

Sets the label style for the field component. It retrieves the label element reference and applies the computed label style.

Returns : void
setStyleOnFieldContainer
setStyleOnFieldContainer()

Applies the styles to the field container element.

Returns : void
setUseDateTimeZones
setUseDateTimeZones(useDateTimeZones: boolean)

Updates the DATETIME-TZ usage preference on this field and its wrapper.

Parameters :
Name Type Optional Description
useDateTimeZones boolean No

Whether DATETIME-TZ offsets should be used.

Returns : void
updateImageURL
updateImageURL()

Updates the image URL based on the input settings of the field. It is called whenever the image file name is updated.

Returns : void
updateValue
updateValue(value: any, publishUpdate: unknown)

Updates the value of the field and optionally publishes the update.

Parameters :
Name Type Optional Default value Description
value any No this.model
  • The new value to set for the field. Defaults to the current model value.
publishUpdate unknown No true
  • Indicates whether to publish the update to the helper service.
Returns : void

Properties

buttonComponentContainer
Type : ViewContainerRef
Decorators :
@ViewChild('buttonContainer', {read: ViewContainerRef})
checkBoxLabel
Type : ElementRef
Decorators :
@ViewChild('label', {read: ElementRef})
contentStyle
Type : any
Default value : {}

set on wrapper, absolute positioning properties

fieldComponentContainer
Type : ViewContainerRef
Decorators :
@ViewChild('fieldComponentContainer', {read: ViewContainerRef})
fieldLabel
Type : ElementRef
Decorators :
@ViewChild('fieldLabel', {read: ElementRef})
fieldStyle
Type : any
Default value : {}

customization for the field element

Public formInstanceService
Type : SmartFormInstanceService
Decorators :
@Optional()
Public helperService
Type : SmartViewerHelperService<AbstractFrameComponent>
imageURL
Type : string | SafeResourceUrl
isRegularField
Type : unknown
Default value : false
labelStyle
Type : any
Default value : {}

contains field's label customization + absolute positioning properties

mandatory
Type : boolean
showDatePickerWeekNumbers
Type : unknown
Default value : false
textArea
Type : ElementRef
Decorators :
@ViewChild('vTextArea', {read: ElementRef})

Accessors

field
getfield()

Returns the field settings.

setfield(value: SmartViewerFieldSettings)

Sets the field settings.

Parameters :
Name Type Optional Description
value SmartViewerFieldSettings No
  • The field settings.
Returns : void
inlineLabel
getinlineLabel()

Returns whether the label is inline.

Returns : boolean
setinlineLabel(value: boolean)

Sets the inline label flag.

Parameters :
Name Type Optional Description
value boolean No
  • Whether the label is inline.
Returns : void
hasAbsolutePosition
gethasAbsolutePosition()

Returns whether the field uses absolute positioning.

Returns : boolean
sethasAbsolutePosition(value: boolean)

Sets whether the field uses absolute positioning.

Parameters :
Name Type Optional Description
value boolean No
  • The absolute position flag.
Returns : void
fieldLabelOverride
getfieldLabelOverride()

Returns the field label override.

Returns : string
setfieldLabelOverride(value: string)

Sets the field label override.

Parameters :
Name Type Optional Description
value string No
  • The override label.
Returns : void
helpUrl
gethelpUrl()
Returns : string
sethelpUrl(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
container
getcontainer()
Returns : ViewContainerRef
setcontainer(value: ViewContainerRef)
Parameters :
Name Type Optional
value ViewContainerRef No
Returns : void
selected
getselected()

Returns the selected record.

Returns : any
setselected(value: any)

Sets the selected record.

Parameters :
Name Type Optional Description
value any No
  • The selected record.
Returns : void
fieldContainerStyle
getfieldContainerStyle()

Returns the field container style object.

Returns : any
setfieldContainerStyle(value: any)

Sets the field container style object.

Parameters :
Name Type Optional Description
value any No
  • The style object.
Returns : void
classList
getclassList()

Returns the class list for the field.

Returns : any
setclassList(value: any)

Sets the class list for the field.

Parameters :
Name Type Optional Description
value any No
  • The class list.
Returns : void
height
getheight()
top
gettop()
Returns : number
buttonImageUrl
getbuttonImageUrl()
Returns : string
buttonIcon
getbuttonIcon()
Returns : string
isButton
getisButton()
Returns : boolean
isNumeric
getisNumeric()
Returns : boolean
model
getmodel()
Returns : any
setmodel(value: any)
Parameters :
Name Type Optional
value any 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        : field.component.html
    Purpose     : Template for field.
    Author(s)   : Radu Nicoara
    Created     : Dec 07, 2017
--------------------------------------------------------------------------
-->
@if (!!_selectedSignal()) {
<kendo-form-field
    [ngClass]="_classListSignal()" 
    [ngStyle]="_fieldContainerStyleSignal()"
    >
    @if (!_fieldSignal().inputSettings?.noLabel) {
        @if ((_fieldLabelOverrideSignal() || _fieldSignal().label) && _fieldSignal().inputSettings.inputType !== 'checkbox' && _fieldSignal().inputSettings.inputType !== 'button' && _fieldSignal().type !== 'text') {
            <kendo-label #fieldLabel [text]="_fieldLabelOverrideSignal() || _fieldSignal().label">
                @if (_fieldSignal().required || _fieldSignal().definition?.mandatory) {
                <span class="k-required smart-field-required">*</span>
                }
            </kendo-label>
        } @else if ((!_fieldLabelOverrideSignal() && !_fieldSignal().label) && _fieldSignal().preserveLabelSpace) {
            <kendo-label #fieldLabel [text]="'&nbsp;'"></kendo-label>
        } @else if (
            (_fieldLabelOverrideSignal() || _fieldSignal().label) &&
            (_fieldSignal().inputSettings.inputType === 'checkbox' || _fieldSignal().inputSettings.inputType === 'button' || _fieldSignal().type === 'text') && 
            _fieldSignal().preserveLabelSpace
        ) {
            <kendo-label #fieldLabel [text]="'&nbsp;'"></kendo-label>
        }
    } @else if (_fieldSignal().preserveLabelSpace) {
        <kendo-label #fieldLabel [text]="'&nbsp;'"></kendo-label>
    }
    <div #fieldComponentContainer></div>
</kendo-form-field>
}

./field.component.css

/**********************************************************************
 * 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        : field.component.css
    Purpose     : Styles for field.
    Author(s)   : Radu Nicoara
    Created     : Dec 21, 2017
  ----------------------------------------------------------------------*/

::ng-deep input[disabled],
::ng-deep textarea[disabled],
::ng-deep select[disabled],
::ng-deep [smart-widget-disabled],
::ng-deep span.k-numeric-wrap[smart-widget-disabled] {
    opacity: 1 !important;
}

::ng-deep smart-viewer-field:not(.absolute-positioned) .k-form-field.vertical-stretch {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}
::ng-deep smart-viewer-field:not(.absolute-positioned) .k-form-field.vertical-stretch.inline-label {
    flex-direction: row !important;
    padding-bottom: 10px !important;
}
::ng-deep .smart-editor {
    width: 100%;
}

::ng-deep kendo-textarea.k-textarea.k-disabled .k-input-inner {
    cursor: default !important;
    pointer-events: auto !important;
}

::ng-deep smart-viewer-field:not(.absolute-positioned) .k-form-field .vertical-stretch .smart-editor .k-input-inner {
    height: 100%;
}

::ng-deep smart-viewer-field:not(.absolute-positioned) .inline-label .smart-editor.vertical-stretch {
    height: 100% !important;
}
::ng-deep smart-viewer-field:not(.absolute-positioned) .smart-editor.vertical-stretch .k-input-inner {
    height: 100% !important;
    position: absolute !important;
    left: 0; 
    top: 0;
    padding: 5px !important;
}

::ng-deep .k-form-field.smart-checkbox {
    display: flex !important;
    margin-top: 0px !important;
}


::ng-deep kendo-autocomplete.k-state-disabled {
    padding-right: 0px !important;
}

::ng-deep .k-form-field.inline-label > span {
    width: auto !important;
    line-height: 1.7 !important;
    padding-inline-end: 5px !important;
    align-self: start !important;
}

::ng-deep .k-animation-container {
    z-index: 1000;
}

::ng-deep .k-autocomplete {
    padding-right: 0px !important;
}

::ng-deep .smart-checkbox .disabled {
    pointer-events: none !important;
}


::ng-deep .labels-left-field {
    margin-top: 1em !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    gap: 16px !important;
}

::ng-deep .labels-left-field > :first-child {
    text-align: start !important;
    min-width: 25% !important;
    margin-top: 0px !important;
}

::ng-deep .labels-left-field:not(.absolute-positioned) > :last-child {
    flex: 1 !important;
}

::ng-deep .labels-left-field .k-form-field.form-field-label .form-field-div,
::ng-deep .labels-left-field .k-form-field.form-field-label .form-field-input,
::ng-deep .labels-left-field .k-form-field.form-field-label kendo-numerictextbox,
::ng-deep .labels-left-field .k-form-field.form-field-label kendo-textarea,
::ng-deep .labels-left-field .k-form-field.form-field-label smart-lookup,
::ng-deep .labels-left-field .k-form-field.form-field-label smart-combo-editor,
::ng-deep .labels-left-field .k-form-field.form-field-label smart-radio-set,
::ng-deep .labels-left-field .k-form-field.form-field-label smart-logical-combo,
::ng-deep .labels-left-field .k-form-field.form-field-label smart-radio-set {
    flex: 1 !important;
}
::ng-deep .labels-left-field:not(.absolute-positioned) .k-form-field.form-field-label span {
    left: 0 !important;
}

@media screen and (max-width: 2600px) {
    ::ng-deep .labels-left-field > :first-child {
        min-width: 15% !important;
    }
}

@media screen and (max-width: 2000px) {
    ::ng-deep .labels-left-field > :first-child {
        min-width: 20% !important;
    }
}

::ng-deep 
.labels-left-field > :first-child[type="checkbox"],
.labels-left-field > :first-child[type="button"] {
    min-width: unset !important;
}

::ng-deep .labels-left-field:not(.absolute-positioned) .k-form-field.form-field-label.vertical-stretch {
    flex-direction: row !important;
}

::ng-deep .tooltip.fade {
    z-index: 10000;
}

::ng-deep :not(.labels-left-field) smart-combo-editor {
    display: block !important;
}

::ng-deep .k-form-field.smart-checkbox:not(.inline-label) {
    flex-direction: column;
    margin-top: 0px !important;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""