import { Widget, EqContext, WidgetGroup } from '@easyquery/core'
import { QueryPanelOptions } from '@easyquery/ui'

declare var jQuery:any;

export class JQueryFilterBarWidget extends Widget {       
    private jqueryWrapper : any;

    constructor(slot : HTMLElement) {
        super(slot);

        this.jqueryWrapper = jQuery(slot);
        this.widgetType = "filterBar";
        this.group = WidgetGroup.Query;
    }

    public init(context : EqContext, options?: QueryPanelOptions) {    
        super.init(context, options);          
     
        this.jqueryWrapper.FilterBar(options)
        this.jqueryWrapper.FilterBar("setQuery", this.context.getQuery());
        this.jqueryWrapper.FilterBar("setContext", this.context);
    }


    protected refreshCore() {
        this.jqueryWrapper.FilterBar("refresh");
    }

  
}