"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GridFilterPopup = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const useGridFilterExpressionEditor_1 = require("./useGridFilterExpressionEditor");
const GridFilterPopupUI_1 = require("./GridFilterPopupUI");
const GridFilterPopup = () => {
    const hookData = (0, useGridFilterExpressionEditor_1.useGridFilterExpressionEditor)();
    // Create callback handlers
    const handleExpressionChange = (value) => {
        hookData.setExpression(value);
    };
    const handleRunQuery = (expression) => {
        hookData.runQuery(expression);
    };
    const handleClearQuery = () => {
        hookData.clearQuery();
    };
    const handleSaveQuery = () => {
        hookData.saveQuery();
    };
    const handleSuspend = () => {
        hookData.suspendGridFilter();
    };
    const handleUnsuspend = () => {
        hookData.unSuspendGridFilter();
    };
    const handleExpand = () => {
        hookData.onExpand();
    };
    const handleSelectNamedQuery = (query) => {
        handleRunQuery(query);
    };
    const handleSetGridFilterExpression = (query) => {
        hookData.setGridFilterExpression(query);
    };
    return (React.createElement(GridFilterPopupUI_1.GridFilterPopupUI, { expression: hookData.expression, isExpressionValid: hookData.isExpressionValid, isExpressionNamedQuery: hookData.isExpressionNamedQuery, isSuspended: hookData.isSuspended, isReadOnly: hookData.isReadOnly, availableColumns: hookData.availableColumns, namedQueries: hookData.namedQueries, cachedQueries: hookData.cachedQueries, currentGridFilterExpression: hookData.gridFilter?.Expression, headerText: "Grid Filter", glyphicon: "grid-filter", infoLink: hookData.gridFilterHelpPage, infoLinkDisabled: hookData.gridFilterLinkDisabled, onExpressionChange: handleExpressionChange, onRunQuery: handleRunQuery, onClearQuery: handleClearQuery, onSaveQuery: handleSaveQuery, onSuspend: handleSuspend, onUnsuspend: handleUnsuspend, onExpand: handleExpand, onSelectNamedQuery: handleSelectNamedQuery, onSetGridFilterExpression: handleSetGridFilterExpression, gridFilterAccessLevel: hookData.gridFilterAccessLevel, namedQueryAccessLevel: hookData.namedQueryModuleAccessLevel }));
};
exports.GridFilterPopup = GridFilterPopup;
