import { jsxDEV } from "react/jsx-dev-runtime";
import { QueryLanguage } from "@contember/binding";
import { FieldContainer, Checkbox } from "@contember/ui";
import { dataGridCellsDictionary } from "./dataGridCellsDictionary.js";
import { useMessageFormatter } from "../../../../../i18n/useMessageFormatter.js";
const NullConditionFilter = ({ filter, setFilter, field, environment, showNullConditionFilter }) => {
  const formatMessage = useMessageFormatter(dataGridCellsDictionary);
  const desugared = QueryLanguage.desugarRelativeSingleField(field, environment);
  const entitySchema = environment.getSubTreeNode().entity;
  const fieldSchema = entitySchema.fields.get(desugared.field);
  const showFilter = showNullConditionFilter ?? fieldSchema?.nullable === true;
  if (!showFilter) {
    return null;
  }
  return /* @__PURE__ */ jsxDEV(
    FieldContainer,
    {
      label: /* @__PURE__ */ jsxDEV("i", { style: { opacity: 0.8, fontWeight: "normal" }, children: formatMessage("dataGridCells.includeNull") }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NullConditionFilter.tsx",
        lineNumber: 33,
        columnNumber: 11
      }, globalThis),
      labelPosition: "labelInlineRight",
      children: /* @__PURE__ */ jsxDEV(
        Checkbox,
        {
          notNull: true,
          value: filter.nullCondition,
          onChange: (checked) => {
            setFilter({
              ...filter,
              nullCondition: !!checked
            });
          }
        },
        void 0,
        false,
        {
          fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NullConditionFilter.tsx",
          lineNumber: 38,
          columnNumber: 4
        },
        globalThis
      )
    },
    "__null",
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/NullConditionFilter.tsx",
      lineNumber: 31,
      columnNumber: 3
    },
    globalThis
  );
};
export {
  NullConditionFilter
};
//# sourceMappingURL=NullConditionFilter.js.map
