* Sets the node type for the tree, if it hasn't been set yet. * * This will be called by the first node that's rendered in order for the tree * to determine what data transformations are required.
(newType: 'flat' | 'nested')
| 323 | * to determine what data transformations are required. |
| 324 | */ |
| 325 | _setNodeTypeIfUnset(newType: 'flat' | 'nested') { |
| 326 | const currentType = this._nodeType.value; |
| 327 | |
| 328 | if (currentType === null) { |
| 329 | this._nodeType.next(newType); |
| 330 | } else if ((typeof ngDevMode === 'undefined' || ngDevMode) && currentType !== newType) { |
| 331 | console.warn( |
| 332 | `Tree is using conflicting node types which can cause unexpected behavior. ` + |
| 333 | `Please use tree nodes of the same type (e.g. only flat or only nested). ` + |
| 334 | `Current node type: "${currentType}", new node type "${newType}".`, |
| 335 | ); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Switch to the provided data source by resetting the data and unsubscribing from the current |