import { Component, QueryLanguage } from "@contember/binding";
import { ControlledDataGrid } from "./ControlledDataGrid.js";
import { renderGrid } from "./renderGrid.js";
import { jsxDEV } from "react/jsx-dev-runtime";
import { useDataGrid } from "../base/useDataGrid.js";
import { DATA_GRID_DEFAULT_ITEMS_PER_PAGE } from "../base/useDataGridState.js";
import { extractDataGridColumns } from "../structure/gridTemplateAnalyzer.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/DataGrid/grid/DataGrid.tsx";
const DataGrid = Component((props) => {
  return /* @__PURE__ */ jsxDEV(ControlledDataGrid, {
    ...useDataGrid(props)
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 27,
    columnNumber: 10
  }, void 0);
}, (props, environment) => {
  const columns = extractDataGridColumns(props.children);
  const fakeState = {
    columns,
    paging: {
      itemsPerPage: props.itemsPerPage ?? DATA_GRID_DEFAULT_ITEMS_PER_PAGE,
      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
