import { createElement } from "react";
import { Component, QueryLanguage } from "@contember/binding";
import { ControlledDataGrid } from "./ControlledDataGrid.js";
import { renderGrid } from "./renderGrid.js";
import { useDataGrid } from "../base/useDataGrid.js";
import { extractDataGridColumns } from "../structure/gridTemplateAnalyzer.js";
const DataGrid = Component((props) => {
  return /* @__PURE__ */ createElement(ControlledDataGrid, {
    ...useDataGrid(props)
  });
}, (props, environment) => {
  const columns = extractDataGridColumns(props.children);
  const fakeState = {
    columns,
    paging: {
      itemsPerPage: props.itemsPerPage ?? null,
      pageIndex: 0
    },
    hiddenColumns: {},
    filterArtifacts: {},
    orderDirections: {},
    orderBy: [],
    entities: QueryLanguage.desugarQualifiedEntityList({ entities: props.entities }, environment),
    filter: { and: [{}] },
    layout: "default"
  };
  return renderGrid({ setFilter: () => null, setIsColumnHidden: () => null, setOrderBy: () => null, updatePaging: () => null, setLayout: () => null }, void 0, fakeState, fakeState, environment, {
    tile: props.tile
  }, "component" in props ? props.component : void 0, "componentProps" in props ? props.componentProps : void 0);
}, "DataGrid");
export { DataGrid };
//# sourceMappingURL=DataGrid.js.map
