@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
15 lines (14 loc) • 1.64 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { useAdaptable } from '../../View/AdaptableContext';
import { CheckBox } from '../CheckBox';
import EditorButton from './EditorButton';
import { Flex } from '../Flex';
export const NamedQueryEditor = (props) => {
const adaptable = useAdaptable();
const [showColumnIds, setShowColumnIds] = React.useState(false);
const [inlineQuery, setInlineQuery] = React.useState(false);
return (_jsxs(Flex, { flexDirection: "column", alignItems: "flex-start", className: "twa:mt-[2px]", children: [_jsx(CheckBox, { checked: showColumnIds, onChange: (checked) => setShowColumnIds(checked), children: "Show Column IDs" }), _jsx(CheckBox, { checked: inlineQuery, onChange: (checked) => setInlineQuery(checked), children: "Inline Query" }), props.namedQueries.map((namedQuery) => (_jsxs(Flex, { flexDirection: "column", alignItems: "flex-start", className: "twa:p-1 twa:my-2 twa:w-full twa:bg-primarylight", children: [' ', _jsx(EditorButton, { className: "twa:w-full twa:h-full twa:bg-primary twa:cursor-grab", data: inlineQuery ? namedQuery.BooleanExpression : `QUERY("${namedQuery.Name}")`, "data-name": "column", icon: "drag", children: _jsx(Flex, { flexDirection: "column", alignItems: "flex-start", children: namedQuery.Name }) }), _jsx(Flex, { alignItems: "flex-start", className: "twa:p-1", children: showColumnIds
? namedQuery.BooleanExpression
: adaptable.api.expressionApi.getAdaptableQueryExpressionWithColumnFriendlyNames(namedQuery) })] }, namedQuery.Uuid)))] }));
};