import {iTableCellRenderScope} from "../../table/utils/table.utils";
import {useStyles} from "@peryl/react-compose";
import {unit} from "@peryl/utils/unit";
import {DropdownOption} from "../../../DropdownOption";
import {iTreeCore} from "../../../TreeCore/createTreeCore";
import {iPlcTreePropsType, iPlcTreeScopeSlotsType, PlcTreeButtonSize} from "./PlcTree.utils";
import {RenderPlcTreeNode} from "./RenderPlcTreeNode";
import {iTableRefer} from "../../table/Table";
import {tPlcType} from "../../plc/utils/plc.utils";
import {PlcTreeHeader} from "./PlcTreeHeader";
import i18n from "../../../i18n";
export function usePlcTreeRenderNode(
{
treeCore,
props,
scopeSlots,
table,
getPlcRefer,
}: {
treeCore: iTreeCore,
props: iPlcTreePropsType,
scopeSlots: iPlcTreeScopeSlotsType,
table: iTableRefer,
getPlcRefer: () => tPlcType,
}
) {
const buttonStyles = useStyles(styles => {
styles.width = unit(PlcTreeButtonSize);
styles.height = unit(PlcTreeButtonSize);
});
/**
* 渲染列标题
* @author 韦胜健
* @date 2022.11.21 11:43
*/
const renderTreeHead = () => (
<>
{props.multiple && <>
>}
{props.title}
>
);
/**
* 渲染节点内容
* @author 韦胜健
* @date 2022.11.21 11:43
*/
const renderTreeNode = (renderScope: iTableCellRenderScope) => {
const treeNode = treeCore.flatNodeComputedData.value[renderScope.node.state.index];
if (!treeNode) {
return null;
}
return (
);
};
return {
renderTreeHead,
renderTreeNode,
};
}