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

declare var jQuery:any;

export class JQueryEntitiesPanelWidget extends Widget {       
    private jqueryWrapper : any;

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

        this.jqueryWrapper = jQuery(slot);
        this.widgetType = "entitiesPanel";
        this.group = WidgetGroup.Model;
    }

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


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

}
