File

src/ui/viewer/smart-viewer.component.ts

Extends

AbstractFormChild

Implements

OnInit AfterViewInit OnDestroy

Metadata

providers SmartHttpService
selector smart-viewer
styleUrls ./smart-viewer.component.css
templateUrl ./smart-viewer.component.html
viewProviders SmartViewerHelperService

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(dsRegistry: DataSourceRegistry, toolbarRegistry: SmartToolbarRegistry, smartHttp: SmartHttpService, smartServiceAdapter: SmartServiceAdapter, navigationService: SmartNavigationService, elementRef: ElementRef, viewerRegistry: SmartViewerRegistryService, errorHandler: SmartErrorHandlerService, widgetFactory: WidgetFacadeFactory, helperService: SmartViewerHelperService, smartConfig: SmartConfig, injector: Injector, renderer: Renderer2, smartFormInstanceService?: SmartFormInstanceService)
Parameters :
Name Type Optional
dsRegistry DataSourceRegistry No
toolbarRegistry SmartToolbarRegistry No
smartHttp SmartHttpService No
smartServiceAdapter SmartServiceAdapter No
navigationService SmartNavigationService No
elementRef ElementRef No
viewerRegistry SmartViewerRegistryService No
errorHandler SmartErrorHandlerService No
widgetFactory WidgetFacadeFactory No
helperService SmartViewerHelperService No
smartConfig SmartConfig No
injector Injector No
renderer Renderer2 No
smartFormInstanceService SmartFormInstanceService Yes

Inputs

focusOnAdd
Type : string

If set, the Smart Viewer will focus this field when it's attached data source adds a record.

focusOnCopy
Type : string

If set, the Smart Viewer will focus this field when a record is copied.

smart-data-source
Type : string

The name of the SmartDataSource that the Smart Viewer should attach itself to.

smart-object-name
Type : string
smart-tableio-source
Type : string

If set, the Smart Viewer will attempt to find the SmartToolbarComponent registered under this name and listen to button clicked events.

smart-viewer-layout
Type : any

The layout (template) that the Smart Viewer should fetch and render.

smart-viewer-settings
Type : literal type
smart-viewer-template
Type : string

The template that the Smart Viewer should render. Note: not to be confused with the smartViewerTemplate. This represents an actual HTML template that should be renderd directly.

Outputs

inputBlurred
Type : EventEmitter<string>
inputFocused
Type : EventEmitter<string>
inputValueChanged
Type : EventEmitter<InputChangedEventArgs>

Fires when an input belonging to the Smart Viewer changes it's value.

selectedChange
Type : EventEmitter<any>
viewerButtonClicked
Type : EventEmitter<SmartViewerFieldSettings>

Methods

checkViewerForUnboundFields
checkViewerForUnboundFields(viewerLayout: any)
Parameters :
Name Type Optional
viewerLayout any No
Returns : void
checkViewersPadding
checkViewersPadding()
Returns : void
componentLoaded
componentLoaded()

Used internally. Sets up key listeners on child input elements that trigger the UPDATING state on the attached datasource when values are changed.

Returns : void
focusField
focusField(fieldToFocus: string)

Moves focus to the specified viewer field input

Parameters :
Name Type Optional Description
fieldToFocus string No

The fully qualified name of the viewer field

Returns : void
Public handleLayoutChange
handleLayoutChange(newLayout: literal type)
Parameters :
Name Type Optional
newLayout literal type No
Returns : void
trackBy
trackBy(index: number)
Parameters :
Name Type Optional
index number No
Returns : number

Properties

createDisabled
Type : boolean
deleteDisabled
Type : boolean
domElement
Type : ElementRef
Decorators :
@ViewChild('fakeComponent')
enabledStateMonitored
Type : QueryList<EnabledStateDirective>
Decorators :
@ContentChildren(EnabledStateDirective)
fieldHeightsAdded
Type : boolean
fields
Type : SmartViewerFormItem[]
fieldsetHeightsAdded
Type : boolean
hasAbsolutePosition
Default value : false
maxDepthValue
Type : number
Default value : 0
readDisabled
Type : boolean
readOnly
Type : boolean
self
Type : any
Default value : this
smartDs
Type : SmartDataSource
Default value : {} as SmartDataSource

The SmartDataSource instance that this viewer is attached to.

smartLookups
Type : QueryList<SmartLookupComponent>
Decorators :
@ContentChildren(SmartLookupComponent)
updateDisabled
Type : boolean
viewerFormPadding
Type : number
Default value : 0
viewerLayout
Type : any
viewerTemplate
Type : SmartViewerTemplateDirective
Decorators :
@ContentChild(SmartViewerTemplateDirective)

Accessors

settings
getsettings()
Returns : literal type
setsettings(value: literal type)
Parameters :
Name Type Optional
value literal type No
Returns : void
state
getstate()

The current state of the Smart Viewer

Returns : VIEWER_STATE
setstate(value)
Parameters :
Name Optional
value No
Returns : void
viewerFormDomElement
getviewerFormDomElement()
Returns : ElementRef
setviewerFormDomElement(viewerForm)
Parameters :
Name Optional
viewerForm No
Returns : void
viewerContainerDomElement
getviewerContainerDomElement()
Returns : ElementRef
setviewerContainerDomElement(container)
Parameters :
Name Optional
container No
Returns : void
fieldChildren
setfieldChildren(fieldChildren)
Parameters :
Name Optional
fieldChildren No
Returns : void
fieldsetChildren
setfieldsetChildren(fieldsetChildren)
Parameters :
Name Optional
fieldsetChildren No
Returns : void
smartViewerTemplate
setsmartViewerTemplate(value: any)

The layout (template) that the Smart Viewer should fetch and render.

Parameters :
Name Type Optional
value any No
Returns : void
template
gettemplate()
Returns : string
settemplate(value: string)

The template that the Smart Viewer should render. Note: not to be confused with the smartViewerTemplate. This represents an actual HTML template that should be renderd directly.

Parameters :
Name Type Optional
value string No
Returns : void
viewerState
getviewerState()
Returns : StateEvents
selected
getselected()

The viewer's attached datasource's selected record.

Returns : any
setselected(value: any)
Parameters :
Name Type Optional
value any No
Returns : void
<div 
    #container id="form-container"
    [ngClass]="settings?.classList">
        <form #viewerForm [ngClass]="(settings?.classList.indexOf('labels-left') > -1 || hasAbsolutePosition) ? 'k-form-inline' : 'k-form'">
            <ng-container *ngFor="let formItem of fields let i=index trackBy: trackBy">
                <smart-viewer-fieldset 
                    *ngIf="formItem.type === 'fieldset'"
                    [hasAbsolutePosition]="hasAbsolutePosition"
                    [definition]="formItem"
                    [itemIndex]="i"
                    [inline-labels]="settings?.classList.indexOf('labels-left') > -1 || hasAbsolutePosition">
                </smart-viewer-fieldset>
                <smart-viewer-group
                    *ngIf="formItem.type === 'group'"
                    [hasAbsolutePosition]="hasAbsolutePosition"
                    [definition]="formItem">
                </smart-viewer-group>
                <smart-viewer-field
                    [ngClass]="{ first: i === 0 }"
                    *ngIf="formItem.type !== 'fieldset' && formItem.type !== 'group'"
                    [hasAbsolutePosition]="hasAbsolutePosition"
                    [field]="formItem"
                    [inline-label]="settings?.classList.indexOf('labels-left') > -1 || hasAbsolutePosition">
                </smart-viewer-field> 
            </ng-container>
            <div class="row" *ngIf="readDisabled">
                <p class="col-12">* Read access is restricted.</p>
            </div>
        </form>
</div>

./smart-viewer.component.css

::ng-deep kendo-numerictextbox .k-numeric-wrap input.k-input {
    text-align: right !important;
    height: 100% !important
}

 ::ng-deep input[disabled],
textarea[disabled],
select[disabled],
[smart-widget-disabled] {
    background-color: #eee !important;
}

::ng-deep input, ::ng-deep label {
    font-weight: normal !important;
}

::ng-deep form.k-form {
    padding-left: 0px !important;
    padding-right: 0px !important;
    position: relative !important;
}

#form-container {
    overflow-y: auto !important;
}

::ng-deep .absolute-layout .k-form-field.smart-checkbox label,
::ng-deep .absolute-layout .k-form-field span {
    white-space: nowrap !important;
}

::ng-deep .absolute-layout .smart-viewer-fieldset {
    margin-top: 0px !important;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""