import * as ko from "knockout" ; import { PageNavigatorViewModel , PagesController } from "@survey/creator" ; import { PageModel , IAction , Action , SurveyModel , } from "survey-core" ; import { ImplementorBase } from "survey-knockout-ui" ; const template = require ( "./page-navigator.html" ) ; export class PageNavigatorView extends PageNavigatorViewModel < SurveyModel > { constructor ( private pagesController ) { super ( pagesController ) ; } protected createActionBarCore ( item ) { var res = super . createActionBarCore ( item ) ; new ImplementorBase ( res ) ; return res ; } } ko . components . register ( "svc-page-navigator" , { viewModel : { createViewModel : ( params , componentInfo ) => { const model = new PageNavigatorView ( params . creator . pagesController ) ; new ImplementorBase ( model ) ; const scrollableViewPort = componentInfo . element . parentElement . parentElement ; scrollableViewPort . onscroll = function ( this , ev ) { return model . onContainerScroll ( ev . currentTarget as HTMLDivElement ) ; } ; ko . utils . domNodeDisposal . addDisposeCallback ( componentInfo . element , ( ) => { scrollableViewPort . onscroll = undefined ; model . dispose ( ) ; } ) ; return model ; } , } , template : template , } ) ;