src/ui/viewer/smart-viewer.component.ts
OnInit
AfterViewInit
OnDestroy
| changeDetection | ChangeDetectionStrategy.OnPush |
| providers |
forwardRef(() => SmartViewerHelperService)
SmartViewerServerSideEventHandlerService
SmartViewerSsehAdapter
SmartViewerPreferencesService
forwardRef(() => SmartFormFieldHelperService)
|
| selector | smart-viewer |
| styleUrls | ./smart-viewer.component.scss |
| templateUrl | ./smart-viewer.component.html |
constructor(dsRegistry: DataSourceRegistry, toolbarRegistry: SmartToolbarRegistry, navigationService: SmartNavigationService, vcRef: ViewContainerRef, changeDetector: ChangeDetectorRef, viewerRegistry: SmartViewerRegistryService, ssehService: SmartViewerServerSideEventHandlerService, smartTabFolderHelperService: TabParentService, smartFormInstanceService: SmartFormInstanceService, injector: Injector)
|
|||||||||||||||||||||||||||||||||
|
Parameters :
|
| 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. |
| focusOnUpdate |
Type : string
|
|
If set, the Smart Viewer will focus this field when it's attached data source updates a record. |
| smart-data-source |
Type : string
|
|
The name of the SmartDataSource that the Smart Viewer should attach itself to. |
| smart-event-handlers |
Type : SSEHEventHandlerDefinitions
|
| smart-group-assign-source |
Type : string
|
|
If set, the Smart Viewer will behave as if it were a TableIO target of the group assign source's TableIO source |
| smart-save-mode |
Type : boolean
|
| smart-show-date-time-zone |
Type : boolean | undefined
|
|
Sets whether DATETIME-TZ timezone badges/selectors are displayed. |
| smart-table-ref |
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-help-url |
Type : string
|
|
The help URL |
| smart-layout-type |
Type : SmartFrameLayoutType
|
| smart-logic-classes |
Type : string[]
|
| smart-object-name |
Type : string
|
| prompt-before-delete |
Type : string
|
| ignoreFlexboxLayout |
Type : boolean
|
| smart-help-text |
Type : string | undefined
|
|
Sets the HelpText value for this form child. |
| smart-instance-name |
Type : string
|
|
The instance name of the component |
| onAdd |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when an add operation is performed |
| onBeforeAdd |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when a before add operation is performed |
| onBeforeDelete |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when a before delete operation is performed |
| onBeforeUpdate |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when a before update operation is performed |
| onDelete |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when a delete operation is performed |
| onUpdate |
Type : EventEmitter<ISmartCUDEventsArgs>
|
|
Emitted when an update operation is performed |
| selectedChange |
Type : EventEmitter<any>
|
| viewerButtonClicked |
Type : EventEmitter<SmartViewerFieldSettings>
|
| buttonClicked |
Type : EventEmitter<SmartViewerFieldSettings>
|
| 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. |
| onAfterAddRecord |
Type : EventEmitter<AfterAddEventArgument>
|
| onAfterCancelRecord |
Type : EventEmitter<AfterCancelEventArgument>
|
| onAfterCopyRecord |
Type : EventEmitter<AfterCopyEventArgument>
|
| onAfterDeleteRecord |
Type : EventEmitter<AfterDeleteEventArgument>
|
| onAfterEnableFields |
Type : EventEmitter<AfterEnableFieldsEventArgument>
|
| onAfterSaveChanges |
Type : EventEmitter<AfterSaveChangesEventArgument>
|
| onBeforeAddRecord |
Type : EventEmitter<BeforeAddEventArgument>
|
| onBeforeCancelRecord |
Type : EventEmitter<BeforeCancelEventArgument>
|
| onBeforeCopyRecord |
Type : EventEmitter<BeforeCopyEventArgument>
|
| onBeforeDeleteRecord |
Type : EventEmitter<BeforeDeleteEventArgument>
|
| onBeforeEnableFields |
Type : EventEmitter<BeforeEnableFieldsEventArgument>
|
| onBeforeSaveChanges |
Type : EventEmitter<BeforeSaveChangesEventArgument>
|
| Public callLogicClassMethod | ||||||||||||
callLogicClassMethod(methodName: string, args: any[])
|
||||||||||||
|
Invokes a specified method on the first available logic class instance that has the method defined.
Parameters :
Returns :
void
|
| checkViewerForUnboundFields | ||||||
checkViewerForUnboundFields(viewerLayout: any)
|
||||||
|
Parameters :
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
|
| disableViewer |
disableViewer()
|
|
Disables all inputs within the Smart Viewer.
Returns :
void
|
| Public Async enableFieldsForUpdate |
enableFieldsForUpdate()
|
|
Enables the fields in the viewer - update button in saveMode = false
Returns :
any
|
| Public enableGroupAssignToolbarMode | ||||||||
enableGroupAssignToolbarMode(toolbar: SmartToolbarComponent)
|
||||||||
|
Switches this viewer into subscription-based toolbar event dispatch because it is the root of a group-assign chain.
Parameters :
Returns :
void
|
| Async enableViewer | ||||||
enableViewer(context?: TableIOTargetContext)
|
||||||
|
Enables all inputs within the Smart Viewer.
Parameters :
Returns :
Promise<boolean>
|
| Public getDataSource | ||||||||
getDataSource(dataSourceName?: string)
|
||||||||
|
Returns the datasource as an observable
Parameters :
Returns :
Observable<SmartDataSource>
the datasource |
| Public getFieldReference | ||||||||
getFieldReference(fieldName: string)
|
||||||||
Type parameters :
|
||||||||
|
Returns field reference
Parameters :
Returns :
T
|
| getSelectedRecords |
getSelectedRecords()
|
|
Returns the selected records
Returns :
any[]
the selected records |
| getTableIoSource |
getTableIoSource()
|
|
Returns the toolbar that is used as the table IO source
Returns :
Promise | SmartToolbarComponent | null
the toolbar that is used as the table IO source |
| Public getToolbarDispatchPolicy | ||||||||
getToolbarDispatchPolicy(button: SmartToolbarButtonComponent)
|
||||||||
|
Returns the click-time toolbar dispatch policy for this viewer.
Parameters :
Returns :
TableIOToolbarDispatchPolicy
The click-time dispatch policy. |
| Public getWidgetFacade | ||||||||
getWidgetFacade(fieldName: string)
|
||||||||
|
Returns a widget facade
Parameters :
Returns :
IWidgetFacade
|
| Public handleAdd |
handleAdd()
|
|
Handles an add operation
Returns :
void
|
| Public handleCancel | ||||||||
handleCancel(downstramToDataSource: unknown)
|
||||||||
|
Handles a cancel operation
Parameters :
Returns :
void
|
| Public handleCopy |
handleCopy()
|
|
Creates a clone of the current record and uses it to perform an add operation on the attached datasource.
Returns :
void
|
| Public Async handleDelete |
handleDelete()
|
|
Handles a delete operation
Returns :
any
|
| Public handleSave |
handleSave()
|
|
Handles a save operation
Returns :
void
|
| Public handleSuppressedToolbarButton | ||||||||||||
handleSuppressedToolbarButton(button: SmartToolbarButtonComponent, context: TableIOToolbarDispatchContext)
|
||||||||||||
|
Restores viewer presentation state after a consumer suppresses central Cancel dispatch without starting a datasource record transaction.
Parameters :
Returns :
void
|
| Public handleToolbarButton | ||||||||||||
handleToolbarButton(button: SmartToolbarButtonComponent, context?: TableIOToolbarDispatchContext)
|
||||||||||||
|
Handles a toolbar button click routed through the active TableIO target.
Parameters :
Returns :
boolean
True when the viewer handled the button. |
| Public handleToolbarCancel |
handleToolbarCancel()
|
|
Handles toolbar cancel using group-assign ownership semantics.
Returns :
void
|
| Public handleUpdate |
handleUpdate()
|
|
Enables the fields for update
Returns :
void
|
| Public handleView |
handleView()
|
|
Handles a view operation
Returns :
void
|
| Public Async saveChanges |
saveChanges()
|
|
Saves the viewer's current datasource changes and resolves after the save-side TableIO state cleanup has completed.
Returns :
Promise<void>
|
| Public Async setFieldEnabled |
setFieldEnabled(field: any, enabled: boolean)
|
|
Given a field definition, sets it's enabled state If a fieldset or field group is provided, it's child fields' enabled state will be updated
Returns :
any
Promise |
| Public syncToolbarWithTableIOState | ||||||||
syncToolbarWithTableIOState(toolbar: ISmartTableIOSource)
|
||||||||
|
Syncs the toolbar button states with the current state of this table IO target. This method is called when the target is activated and should ensure the toolbar buttons reflect the current state
Parameters :
Returns :
void
|
| Public callLogicMethod | ||||||||||||
callLogicMethod(methodName: string, ...args: any[])
|
||||||||||||
|
Calls a method on the logic class instances
Parameters :
Returns :
Promise | any
The result of the method call |
| checkViewersPadding |
checkViewersPadding()
|
|
Updates the viewer's padding
Returns :
void
|
| focusField | ||||||||
focusField(fieldToFocus: string)
|
||||||||
|
Moves focus to the specified viewer field input
Parameters :
Returns :
void
|
| handleLayoutChange | ||||||
handleLayoutChange(newLayout: any)
|
||||||
|
Parameters :
Returns :
void
|
| Public hasDateTimeTZSelectorPreferenceContextMenuItem |
hasDateTimeTZSelectorPreferenceContextMenuItem()
|
|
Indicates whether DATETIME-TZ usage preference applies to this viewer.
Returns :
boolean
|
| Public onViewerContextMenu | ||||||||
onViewerContextMenu(event: MouseEvent)
|
||||||||
|
Shows the viewer preference context menu when applicable.
Parameters :
Returns :
void
|
| Public onViewerPreferenceContextMenuItemSelected | ||||||||
onViewerPreferenceContextMenuItemSelected(event: ContextMenuSelectEvent)
|
||||||||
|
Handles viewer preference context menu item selection.
Parameters :
Returns :
void
|
| trackBy | ||||||
trackBy(index: number)
|
||||||
|
Tells the UI to track components by index
Parameters :
Returns :
number
|
| Async registerTableIOTarget |
registerTableIOTarget()
|
|
Registers the table IO target with the registry
Returns :
any
|
| Public notifyLoadingFinished | ||||||
notifyLoadingFinished(objectName: string)
|
||||||
|
Notifies the parent Smart Form that this form child has finished loading
Parameters :
Returns :
void
void |
| enabledStateMonitored |
Type : QueryList<EnabledStateDirective>
|
Decorators :
@ContentChildren(EnabledStateDirective)
|
| self |
Type : any
|
Default value : this
|
| smartDs |
Type : AbstractSmartDataSource
|
Default value : {} as SmartDataSource
|
|
The SmartDataSource instance that this viewer is attached to. |
| viewerLayout |
Type : any
|
| viewerTemplate |
Type : SmartViewerTemplateDirective
|
Decorators :
@ContentChild(SmartViewerTemplateDirective)
|
| domElement |
Type : ElementRef
|
Decorators :
@ViewChild('fakeComponent')
|
| fieldHeightsAdded |
Type : boolean
|
| fieldsetHeightsAdded |
Type : boolean
|
| helperService |
Type : SmartViewerHelperService<AbstractFrameComponent>
|
| isLabelsLeft |
Type : boolean
|
| maxDepthValue |
Type : number
|
Default value : 0
|
| smartLookups |
Type : QueryList<SmartLookupComponent>
|
Decorators :
@ContentChildren(SmartLookupComponent)
|
| Public viewerFormFieldsContainer |
Type : ViewContainerRef
|
Decorators :
@ViewChild('formFieldsContainer', {read: ViewContainerRef})
|
| viewerFormPadding |
Type : number
|
Default value : 0
|
| Public viewerPreferencesMenu |
Type : ContextMenuComponent
|
Decorators :
@ViewChild('viewerPreferencesMenu', {read: ContextMenuComponent})
|
| Public viewerPreferencesService |
Type : SmartViewerPreferencesService
|
| Public tableIoStateSignal |
Type : WritableSignal<TableIOTargetState>
|
Default value : signal(
TableIOTargetState.IDLE
)
|
|
Signal that tracks the current TableIO operation state. Used for synchronizing state between group assign source/target viewers. |
| Public injector |
Type : Injector
|
| readOnly | ||||||||
getreadOnly()
|
||||||||
|
Returns whether the viewer is read-only.
Returns :
boolean
|
||||||||
setreadOnly(value: boolean)
|
||||||||
|
Sets whether the viewer is read-only.
Parameters :
Returns :
void
|
| useCentralTableIODispatch |
getuseCentralTableIODispatch()
|
|
Returns whether toolbar TableIO button clicks should be centrally routed.
Returns :
boolean
|
| createDisabled | ||||||||
getcreateDisabled()
|
||||||||
|
Returns whether record creation is disabled.
Returns :
boolean
|
||||||||
setcreateDisabled(value: boolean)
|
||||||||
|
Sets whether record creation is disabled.
Parameters :
Returns :
void
|
| deleteDisabled | ||||||||
getdeleteDisabled()
|
||||||||
|
Returns whether record deletion is disabled.
Returns :
boolean
|
||||||||
setdeleteDisabled(value: boolean)
|
||||||||
|
Sets whether record deletion is disabled.
Parameters :
Returns :
void
|
| updateDisabled | ||||||||
getupdateDisabled()
|
||||||||
|
Returns whether record updating is disabled.
Returns :
boolean
|
||||||||
setupdateDisabled(value: boolean)
|
||||||||
|
Sets whether record updating is disabled.
Parameters :
Returns :
void
|
| settings | ||||||
getsettings()
|
||||||
|
|
||||||
setsettings(value: literal type)
|
||||||
|
Parameters :
Returns :
void
|
| showDateTimeZone | ||||||||
setshowDateTimeZone(value: boolean | undefined)
|
||||||||
|
Sets whether DATETIME-TZ timezone badges/selectors are displayed.
Parameters :
Returns :
void
|
| state | ||||||||
getstate()
|
||||||||
|
The current state of the Smart Viewer.
Returns :
VIEWER_STATE
|
||||||||
setstate(value: VIEWER_STATE)
|
||||||||
|
Sets the current state of the Smart Viewer.
Parameters :
Returns :
void
|
| smartViewerTemplate | ||||||
setsmartViewerTemplate(value: any)
|
||||||
|
The layout (template) that the Smart Viewer should fetch and render.
Parameters :
Returns :
void
|
| viewerState |
getviewerState()
|
|
Returns :
StateEvents
|
| tableIOTargetKey |
gettableIOTargetKey()
|
|
The canonical key identifying this viewer as a TableIO target.
Returns :
string
|
| isActiveIOTarget |
getisActiveIOTarget()
|
|
True if this Smart Viewer is the active IO target.
Returns :
boolean
|
| selected | ||||||||
getselected()
|
||||||||
|
The viewer's attached datasource's selected record.
Returns :
any
|
||||||||
setselected(value: any)
|
||||||||
|
Sets the viewer's attached datasource's selected record.
Parameters :
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-viewer.component.html
Purpose : Template for Smart Viewer.
Author(s) : Radu Nicoara
Created : Dec 07, 2017
--------------------------------------------------------------------------
-->
<div
#container id="form-container"
(contextmenu)="onViewerContextMenu($event)">
<form #viewerForm>
<div #formFieldsContainer></div>
</form>
@if (_readDisabledSignal()) {
<div class="row">
<p class="col-12">* Read access is restricted.</p>
</div>
}
@if (hasDateTimeTZSelectorPreferenceContextMenuItem()) {
<kendo-contextmenu
#viewerPreferencesMenu
size="small"
[collision]="{ horizontal: 'fit', vertical: 'flip' }"
[popupAnimate]="{ type: 'fade', duration: 100, direction: 'down' }"
(select)="onViewerPreferenceContextMenuItemSelected($event)">
<kendo-menu-item text="Use timezones" [icon]="viewerPreferencesService.useDateTimeZones() ? 'checkbox-checked' : 'checkbox'" [data]="'use-date-time-zones'" [disabled]="!viewerPreferencesService.preferencesReady()">
</kendo-menu-item>
</kendo-contextmenu>
}
</div>
./smart-viewer.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-viewer.component.scss
Purpose : Styles for Smart Viewer.
Author(s) : Radu Nicoara
Created : Dec 07, 2017
----------------------------------------------------------------------*/
::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] {
opacity: 1 !important;
}
::ng-deep input, ::ng-deep label {
font-weight: normal !important;
}
::ng-deep form.k-form,
::ng-deep form.k-form-inline {
position: relative !important;
min-height: 100% !important;
display: flex !important;
flex-direction: column !important;
}
::ng-deep form.k-form smart-viewer-field:not(.vertical-stretch),
::ng-deep form.k-form smart-viewer-fieldset,
::ng-deep form.k-form smart-viewer-group,
::ng-deep form.k-form-inline smart-viewer-field:not(.vertical-stretch),
::ng-deep form.k-form-inline smart-viewer-fieldset,
::ng-deep form.k-form-inline smart-viewer-group {
flex: 0 !important;
}
::ng-deep form.k-form smart-viewer-field.vertical-stretch:not(.labels-left-field) {
flex: 1 !important;
display: flex !important;
flex-direction: column !important;
}
::ng-deep
form.k-form-inline smart-viewer-field.vertical-stretch,
form.k-form smart-viewer-field.vertical-stretch.labels-left-field {
flex: 1 !important;
display: flex !important;
flex-direction: row !important;
}
::ng-deep form.k-form smart-viewer-field.vertical-stretch > div,
::ng-deep form.k-form smart-viewer-field.vertical-stretch smarteditorwrapper {
flex: 1 !important;
display: flex !important;
}
::ng-deep form.k-form smart-viewer-field.vertical-stretch:not(.labels-left-field) > div {
flex-direction: column !important;
}
#form-container {
overflow-y: auto !important;
height: 100% !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;
}
::ng-deep .before-delete-prompt-dialog {
z-index: 100000 !important;
}