import { jsxDEV } from "react/jsx-dev-runtime";
import { Component, QueryLanguage, wrapFilterInHasOnes, HasMany } from "@contember/binding";
import { FieldContainer, Checkbox } from "@contember/ui";
import { DataGridColumn } from "../base/DataGridColumn.js";
const HasManyAbsentCell = Component((props) => {
  return /* @__PURE__ */ jsxDEV(
    DataGridColumn,
    {
      ...props,
      enableOrdering: false,
      getNewFilter: (filter, { environment }) => {
        if (filter === false) {
          return void 0;
        }
        const desugared = QueryLanguage.desugarRelativeEntityList(props, environment);
        return wrapFilterInHasOnes(desugared.hasOneRelationPath, {
          [desugared.hasManyRelation.field]: {
            id: {
              not: { isNull: true }
            }
          }
        });
      },
      emptyFilter: false,
      filterRenderer: ({ filter, setFilter }) => {
        return /* @__PURE__ */ jsxDEV(
          FieldContainer,
          {
            label: "Has any",
            labelPosition: "labelInlineRight",
            children: /* @__PURE__ */ jsxDEV(Checkbox, { notNull: true, value: filter, onChange: (checked) => setFilter(!!checked) }, void 0, false, {
              fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasManyAbsentCell.tsx",
              lineNumber: 53,
              columnNumber: 6
            }, globalThis)
          },
          void 0,
          false,
          {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasManyAbsentCell.tsx",
            lineNumber: 49,
            columnNumber: 12
          },
          globalThis
        );
      },
      children: /* @__PURE__ */ jsxDEV(HasMany, { ...props, listComponent: props.render }, void 0, false, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasManyAbsentCell.tsx",
        lineNumber: 57,
        columnNumber: 4
      }, globalThis)
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/cells/HasManyAbsentCell.tsx",
      lineNumber: 30,
      columnNumber: 3
    },
    globalThis
  );
}, "HasManyAbsentCell");
export {
  HasManyAbsentCell
};
//# sourceMappingURL=HasManyAbsentCell.js.map
