import * as _StoreMixin from "dgrid/_StoreMixin" ; import * as DGridPagination from "dgrid/extensions/Pagination" ; import * as Tooltip from "dijit/Tooltip" ; import * as declare from "dojo/_base/declare" ; import * as query from "dojo/_base/query" ; export const GridHelper = declare ( null , { allowTextSelection : true , noDataMessage : "<span class='dojoxGridNoData'>...empty...</span>" , loadingMessage : "<span class='dojoxGridNoData'>loading...</span>" , postCreate : function postCreate ( inherited ) { this . inherited ( postCreate , arguments ) ; this . __hpcc_tooltip_header = new Tooltip ( { connectId : [ this . id ] , selector : ".dgrid-resize-header-container" , showDelay : 400 , getContent ( node ) { if ( node . offsetWidth < node . scrollWidth - 4 ) { return node . innerHTML ; } return "" ; } } ) ; this . __hpcc_tooltip_header . position = [ "above-centered" , "below-centered" , "before-centered" , "after-centered" ] ; this . __hpcc_tooltip = new Tooltip ( { connectId : [ this . id ] , selector : "td" , showDelay : 400 , getContent ( node ) { if ( node . offsetWidth <= node . scrollWidth ) { return node . innerHTML ; } return "" ; } } ) ; this . __hpcc_tooltip . position = [ "above-centered" , "below-centered" , "before-centered" , "after-centered" ] ; } , refresh : function refresh ( options ) { this . inherited ( refresh , arguments , [ options || { keepScrollPosition : true , keepCurrentPage : true } ] ) ; } , clearSelection : function clearSelection ( ) { this . inherited ( clearSelection , arguments ) ; query ( "input[type=checkbox]" , this . domNode ) . forEach ( function ( node ) { node . checked = false ; node . indeterminate = false ; } ) ; } } ) ; export const Pagination = declare ( [ DGridPagination ] , { refresh ( options ? ) { const self = this ; const page = options && options . keepCurrentPage ? Math . min ( this . _currentPage , Math . ceil ( this . _total / this . rowsPerPage ) ) || 1 : 1 ; _StoreMixin . prototype . refresh . apply ( this , arguments ) ; return this . gotoPage ( page ) . then ( function ( results ) { self . _emitRefreshComplete ( ) ; return results ; } ) ; } } ) ;