import { Plugin } from 'gridjs/dist/src/plugin.d' ; import { GridFrom , GridOptions } from '../../main.d' ; const activatePlugins = ( component ) : void => { try { const plugins = component . $gridjs . options . plugins ; if ( plugins ) { plugins . forEach ( ( plugin ) => { component . grid . plugin . add ( plugin ) ; } ) ; } } catch ( error ) { console . error ( error ) ; } } ; const from = ( input ) : HTMLElement | DocumentFragment | null => { try { if ( input && typeof input === 'string' ) { return ( document . querySelector ( input ) || ( document . createRange ( ) . createContextualFragment ( input ) as DocumentFragment ) ) ; } return null ; } catch ( error ) { console . error ( error ) ; return null ; } } ; function options ( component ) { try { let options = { ... component . $gridjs . options , autoWidth : component . autoWidth , className : component . className , columns : component . columns , data : component . rows , fixedHeader : component . fixedHeader , from : from ( component . from ) , height : component . height , language : component . language , pagination : component . pagination , resizable : component . resizable , search : component . search , server : component . server , sort : component . sort , style : component . styles || { container : { width : '100%' } , table : { width : '100%' } , header : { width : '100%' } } , width : component . width } ; for ( const key in options ) { if ( options [ key ] === undefined ) { delete options [ key ] ; } } return options ; } catch ( error ) { console . error ( error ) ; return { } ; } } export default options ; export { activatePlugins } ;