import * as React from 'react';
import { useGridFilterExpressionEditor } from './useGridFilterExpressionEditor';
import { GridFilterPopupUI } from './GridFilterPopupUI';
export const GridFilterPopup = () => {
    const hookData = 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, { 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 }));
};
