import * as ko from "knockout" ; import "./object-editor-content.scss" ; import { SurveyElementEditorContentModel } from "../questionEditors/questionEditor" ; const templateHtml = require ( "./object-editor-content.html" ) ; export class ObjectEditorContentViewModel { constructor ( public useTabsInElementEditor , public koTabs , public koActiveTab , public onTabClick ) { } public get activeTab ( ) { const tab = this . koActiveTab ( ) ; if ( typeof tab === "undefined" ) { return this . koTabs ( ) [ 0 ] . name ; } return tab ; } } ko . components . register ( "svd-object-editor-content" , { viewModel : { createViewModel : ( params , componentInfo ) => { let model = params . model ; if ( ! model && typeof params . elementEditorContent === "function" ) { model = params . elementEditorContent ( ) ; } else if ( ! model ) { model = params . elementEditorContent ; } return new ObjectEditorContentViewModel ( model . useTabsInElementEditor , model . koTabs , model . koActiveTab , model [ "onTabClick" ] ) ; } , } , template : templateHtml , } ) ;