import { FC } from "react";
import { DageTreeActionsProps } from "./types";
import { DageTreeTitle } from "./Title";
import { TreeActions } from "./style";

export const DageTreeActions: FC<DageTreeActionsProps> = ({
  maxLevel,
  onAdd,
  onEdit,
  onDelete,
  ...props
}) => {
  return (
    // @ts-ignore
    <TreeActions
      blockNode
      defaultExpandAll
      virtual={false}
      {...props}
      fieldNames={{
        title: "name",
        key: "id",
      }}
      titleRender={(data) => (
        <DageTreeTitle
          // @ts-ignore
          data={data}
          treeData={props.treeData}
          maxLevel={maxLevel}
          onAdd={onAdd}
          onEdit={onEdit}
          onDelete={onDelete}
        />
      )}
    />
  );
};

export * from "./types";
export * from "./utils";
