MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / Tree

Function Tree

packages/utils/src/context-menu.tsx:19–62  ·  view source on GitHub ↗
(props: {
  node?: IPublicModelNode | null;
  children?: React.ReactNode;
  options: IOptions;
})

Source from the content-addressed store, hash-verified

17}
18
19const Tree = (props: {
20 node?: IPublicModelNode | null;
21 children?: React.ReactNode;
22 options: IOptions;
23}) => {
24 const { node } = props;
25
26 if (!node) {
27 return (
28 <div className="engine-context-menu-tree-wrap">{ props.children }</div>
29 );
30 }
31
32 const { common } = props.options.pluginContext || {};
33 const { intl } = common?.utils || {};
34 const indent = node.zLevel * 8 + 32;
35 const style = {
36 paddingLeft: indent,
37 marginLeft: -indent,
38 marginRight: -10,
39 paddingRight: 10,
40 };
41
42 return (
43 <Tree {...props} node={node.parent} >
44 <div
45 className="engine-context-menu-title"
46 onClick={() => {
47 props.options.destroy?.();
48 node.select();
49 }}
50 style={style}
51 >
52 {props.options.nodes?.[0].id === node.id ? (<Icon className="engine-context-menu-tree-selecte-icon" size="small" type="success" />) : null}
53 {intl(node.title)}
54 </div>
55 <div
56 className="engine-context-menu-tree-children"
57 >
58 { props.children }
59 </div>
60 </Tree>
61 );
62};
63
64let destroyFn: Function | undefined;
65

Callers

nothing calls this directly

Calls 3

destroyMethod · 0.65
selectMethod · 0.65
intlFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…