import * as React from 'react' ; import FileUtil from '@terrestris/ol-util/dist/FileUtil/FileUtil' ; import { MapComponentProps } from '../../Map/MapComponent/MapComponent' ; param WrappedComponent return export function onDropAware ( WrappedComponent ) { return class DropTargetMap extends React . Component < MapComponentProps > { param event onDrop ( event ) { const { map } = this . props ; event . preventDefault ( ) ; const files = event . dataTransfer . files ; if ( files . length > 0 ) { for ( let i = 0 ; i < files . length ; ++ i ) { const file = files [ i ] ; if ( file . name . match ( /\.zip$/g ) ) { FileUtil . addShpLayerFromFile ( file , map ) ; } else { FileUtil . addGeojsonLayerFromFile ( file , map ) ; } } } } param event onDragOver ( event ) { event . preventDefault ( ) ; } return render = ( ) => { return < WrappedComponent onDrop = { this . onDrop . bind ( this ) } onDragOver = { this . onDragOver } { ... this . props } />; } ; } ; } export default onDropAware ;