import { t as React, a6 as GridLoader, j as jsxRuntimeExports, G as Grid, bC as ButtonsForGridComponent } from "./index-D15x63tD.js";
function AccountsTable({ props }) {
  const [mainGrid, setMainGrid] = React.useState();
  const [countRecords, setCountRecords] = React.useState();
  const [selectedRecordID, setSelectedRecordID] = React.useState();
  const gridPanel = React.useRef();
  React.useEffect(() => {
    GridLoader(gridPanel.current, props, {
      setSelectedRecord: setSelectedRecordID
    }).then((res) => {
      setMainGrid(res);
    });
  }, []);
  React.useEffect(() => {
    if (mainGrid) {
      setTimeout(() => {
        mainGrid.grid.updateGridSize();
      }, 251);
      setCountRecords(mainGrid.source.recordCount);
    }
  }, [mainGrid]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Grid,
    {
      container: true,
      direction: "column",
      justifyContent: "flex-start",
      alignItems: "flex-start",
      style: { width: "100%", height: "100%" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, style: { width: "100%", height: "30px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          ButtonsForGridComponent,
          {
            onClick: () => {
              mainGrid.grid.Rotate();
            },
            grid: mainGrid,
            selectedRecord: selectedRecordID,
            buttons: {
              navigate: true,
              delete: true,
              save: true,
              card: true,
              create: true,
              editButtons: true
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { style: { width: "100%", height: "calc(100% - 60px)" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: gridPanel, style: { width: "100%", height: "100%", position: "relative" } }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Grid,
          {
            item: true,
            style: {
              width: "100%",
              height: "30px",
              display: "flex",
              alignItems: "center",
              paddingLeft: "10px",
              border: "1px solid rgb(200, 181, 143)"
            },
            children: [
              "Количество проводок: ",
              countRecords
            ]
          }
        )
      ]
    }
  );
}
export {
  AccountsTable as default
};
//# sourceMappingURL=AccountsTable-BX9fZwVz.js.map
