import * as ko from "knockout" ; import "./property-editor.scss" ; import { SurveyPropertyEditorBase } from "../propertyEditors/propertyEditorBase" ; const templateHtml = require ( "./property-editor.html" ) ; export class PropertyEditorViewModel { public showHelpText = ko . observable ( false ) ; public toggleShowHelpText = ( ) => { this . showHelpText ( ! this . showHelpText ( ) ) ; } ; constructor ( public showDisplayNameOnTop , public displayName , public contentTemplateName , public helpText , public model , public afterRender ) { } } ko . components . register ( "svd-property-editor" , { viewModel : { createViewModel : ( params , componentInfo ) => { const model = params . model ; const afterRender = params . afterRender || model . koAfterRender ; return new PropertyEditorViewModel ( model . showDisplayNameOnTop , model . displayName , model . contentTemplateName , model . propertyHelpText , model , ( ) => { afterRender . call ( model , componentInfo , { property : model . property , editor : model , } ) ; } ) ; } , } , template : templateHtml , } ) ;