MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / insertChild

Function insertChild

packages/designer/src/document/node/node.ts:1481–1504  ·  view source on GitHub ↗
(
  container: INode,
  thing: INode | IPublicTypeNodeData,
  at?: number | null,
  copy?: boolean,
)

Source from the content-addressed store, hash-verified

1479}
1480
1481export function insertChild(
1482 container: INode,
1483 thing: INode | IPublicTypeNodeData,
1484 at?: number | null,
1485 copy?: boolean,
1486): INode | null {
1487 let node: INode | null | IRootNode | undefined;
1488 let nodeSchema: IPublicTypeNodeSchema;
1489 if (isNode<INode>(thing) && (copy || thing.isSlot())) {
1490 nodeSchema = thing.export(IPublicEnumTransformStage.Clone);
1491 node = container.document?.createNode(nodeSchema);
1492 } else if (isNode<INode>(thing)) {
1493 node = thing;
1494 } else if (isNodeSchema(thing)) {
1495 node = container.document?.createNode(thing);
1496 }
1497
1498 if (isNode<INode>(node)) {
1499 container.children?.insert(node, at);
1500 return node;
1501 }
1502
1503 return null;
1504}
1505
1506export function insertChildren(
1507 container: INode,

Callers 3

insertNodeMethod · 0.90
wrapWithMethod · 0.90
insertChildrenFunction · 0.70

Calls 6

isNodeFunction · 0.85
isSlotMethod · 0.65
exportMethod · 0.65
createNodeMethod · 0.65
insertMethod · 0.65
isNodeSchemaFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…