import { h } from "@stencil/core";
import Tunnel from '../../../locale/i18n.provider';
export class BooleanFilterPanel {
    async reset() {
        this.element.querySelector('form').reset();
    }
    onSubmit(e) {
        e.preventDefault();
        const check = e.target.querySelector('input');
        this.anjFilterChange.emit({ field: this.field, type: 'equals', query: check.checked });
    }
    render() {
        return (h("form", { onSubmit: (e) => this.onSubmit(e) },
            h("anj-checkbox-group", null,
                h("anj-checkbox", { name: "query" }, this.translator('Show only true'))),
            h("anj-button-group", { align: "right" },
                h("anj-button", { context: "text", type: "submit" }, this.translator('Apply')))));
    }
    static get is() { return "anj-boolean-filter-panel"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() { return {
        "$": ["boolean-filter-panel.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["boolean-filter-panel.css"]
    }; }
    static get properties() { return {
        "field": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "The key we're working with"
            },
            "attribute": "field",
            "reflect": false
        },
        "filter": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "ColumnFilter",
                "resolved": "ColumnFilter",
                "references": {
                    "ColumnFilter": {
                        "location": "import",
                        "path": "../../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Current active filter if it exists"
            }
        },
        "translator": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "IntlFormatFn",
                "resolved": "(value: any, variables?: any) => string",
                "references": {
                    "IntlFormatFn": {
                        "location": "import",
                        "path": "../../../locale/i18n.provider"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [{
                        "text": undefined,
                        "name": "internal"
                    }],
                "text": ""
            }
        },
        "types": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "FilterType[]",
                "resolved": "FilterType[]",
                "references": {
                    "FilterType": {
                        "location": "import",
                        "path": "../../table.types"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Types of filters supported"
            }
        }
    }; }
    static get events() { return [{
            "method": "anjFilterChange",
            "name": "anjFilterChange",
            "bubbles": true,
            "cancelable": true,
            "composed": true,
            "docs": {
                "tags": [],
                "text": "Emitted when the user wants to apply a new filter"
            },
            "complexType": {
                "original": "ColumnFilter",
                "resolved": "ColumnFilter",
                "references": {
                    "ColumnFilter": {
                        "location": "import",
                        "path": "../../table.types"
                    }
                }
            }
        }]; }
    static get methods() { return {
        "reset": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
    static get elementRef() { return "element"; }
}
Tunnel.injectProps(BooleanFilterPanel, ['translator']);
