MCPcopy Create free account
hub / github.com/adobe/react-spectrum / buildNode

Method buildNode

packages/react-stately/src/layout/ListLayout.ts:479–498  ·  view source on GitHub ↗
(node: Node<T>, x: number, y: number)

Source from the content-addressed store, hash-verified

477 }
478
479 protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {
480 switch (node.type) {
481 case 'section':
482 return this.buildSection(node, x, y);
483 case 'item':
484 return this.buildItem(node, x, y);
485 case 'header':
486 return this.buildSectionHeader(node, x, y);
487 case 'loader':
488 return this.buildLoader(node, x, y);
489 case 'separator':
490 return this.buildItem(node, x, y);
491 // uses buildSection instead of buildItem cuz it has a child node (the trigger)
492 // that need to be processed
493 case 'submenutrigger':
494 return this.buildSection(node, x, y);
495 default:
496 throw new Error('Unsupported node type: ' + node.type);
497 }
498 }
499
500 protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {
501 let rect = new Rect(x, y, this.padding, 0);

Callers 1

buildChildMethod · 0.95

Calls 4

buildSectionMethod · 0.95
buildItemMethod · 0.95
buildSectionHeaderMethod · 0.95
buildLoaderMethod · 0.95

Tested by

no test coverage detected