@@ -5,7 +5,7 @@ import { action } from 'mobx';
55import * as React from 'react' ;
66
77import { JSONSchema4 } from 'json-schema' ;
8- import { SchemaTree , SchemaTreeOptions , SchemaTreeRefDereferenceFn } from '../tree/tree' ;
8+ import { SchemaTree , SchemaTreeOptions , SchemaTreePopulateHandler , SchemaTreeRefDereferenceFn } from '../tree/tree' ;
99import { GoToRefHandler , RowRenderer } from '../types' ;
1010import { isSchemaViewerEmpty } from '../utils/isSchemaViewerEmpty' ;
1111import { SchemaTree as SchemaTreeComponent } from './SchemaTree' ;
@@ -24,6 +24,7 @@ export interface IJsonSchemaViewer {
2424 mergeAllOf ?: boolean ;
2525 FallbackComponent ?: typeof FallbackComponent ;
2626 rowRenderer ?: RowRenderer ;
27+ onTreePopulate ?: SchemaTreePopulateHandler ;
2728 resolveRef ?: SchemaTreeRefDereferenceFn ;
2829 shouldResolveEagerly ?: boolean ;
2930}
@@ -49,6 +50,7 @@ export class JsonSchemaViewerComponent extends React.PureComponent<IJsonSchemaVi
4950 mergeAllOf : this . mergeAllOf ,
5051 resolveRef : this . props . resolveRef ,
5152 shouldResolveEagerly : ! ! this . props . shouldResolveEagerly ,
53+ onPopulate : this . props . onTreePopulate ,
5254 } ;
5355 }
5456
@@ -86,6 +88,10 @@ export class JsonSchemaViewerComponent extends React.PureComponent<IJsonSchemaVi
8688 this . tree . treeOptions . resolveRef = this . props . resolveRef ;
8789 }
8890
91+ if ( prevProps . onTreePopulate !== this . props . onTreePopulate ) {
92+ this . tree . treeOptions . onPopulate = this . props . onTreePopulate ;
93+ }
94+
8995 if (
9096 this . treeStore . defaultExpandedDepth !== this . expandedDepth ||
9197 prevProps . schema !== this . props . schema ||
0 commit comments