@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client';
33import './index.css' ;
44
55import { IgrPropertyEditorPanelModule } from 'igniteui-react-layouts' ;
6- import { IgrTreemapModule , TreemapHighlightingMode } from 'igniteui-react-charts' ;
6+ import { IgrTreemapModule } from 'igniteui-react-charts' ;
77import { IgrPropertyEditorPanel , IgrPropertyEditorPropertyDescription } from 'igniteui-react-layouts' ;
88import { IgrTreemap } from 'igniteui-react-charts' ;
99import { ComponentRenderer , PropertyEditorPanelDescriptionModule , TreemapDescriptionModule } from 'igniteui-react-core' ;
@@ -18,36 +18,50 @@ const mods: any[] = [
1818mods . forEach ( ( m ) => m . register ( ) ) ;
1919
2020export default class Sample extends React . Component < any , any > {
21-
21+ private propertyEditor : IgrPropertyEditorPanel
22+ private propertyEditorRef ( r : IgrPropertyEditorPanel ) {
23+ this . propertyEditor = r ;
24+ this . setState ( { } ) ;
25+ }
2226 private highlightedModeEditor : IgrPropertyEditorPropertyDescription
2327 private treemap : IgrTreemap
2428 private treemapRef ( r : IgrTreemap ) {
2529 this . treemap = r ;
2630 this . setState ( { } ) ;
27- this . onHighlightingModeChange = this . onHighlightingModeChange . bind ( this ) ;
2831 }
2932
3033 constructor ( props : any ) {
3134 super ( props ) ;
32-
35+
36+ this . propertyEditorRef = this . propertyEditorRef . bind ( this ) ;
3337 this . treemapRef = this . treemapRef . bind ( this ) ;
3438 }
3539
3640 public render ( ) : JSX . Element {
3741 return (
3842 < div className = "container sample" >
39- < div className = "options horizontal" >
40- < select onChange = { this . onHighlightingModeChange } >
41- < option > Brighten</ option >
42- < option > FadeOthers</ option >
43- </ select >
43+ < div className = "options vertical" >
44+ < IgrPropertyEditorPanel
45+ ref = { this . propertyEditorRef }
46+ componentRenderer = { this . renderer }
47+ target = { this . treemap }
48+ descriptionType = "Treemap"
49+ isHorizontal = "true"
50+ isWrappingEnabled = "true" >
51+ < IgrPropertyEditorPropertyDescription
52+ propertyPath = "HighlightingMode"
53+ name = "HighlightedModeEditor"
54+ label = "Highlighting Mode: "
55+ primitiveValue = "Brighten"
56+ dropDownValues = { [ "Brighten" , "FadeOthers" ] } >
57+ </ IgrPropertyEditorPropertyDescription >
58+ </ IgrPropertyEditorPanel >
4459 </ div >
4560
4661 < div className = "legend-title" >
4762 Comparing Population of Countries
4863 </ div >
4964
50-
5165 < div className = "container fill" >
5266 < IgrTreemap
5367 ref = { this . treemapRef }
@@ -68,25 +82,13 @@ export default class Sample extends React.Component<any, any> {
6882 parentNodeRightPadding = "0"
6983 parentNodeTopPadding = "0"
7084 outline = "black"
71- strokeThickness = "1"
72- highlightingMode = { TreemapHighlightingMode . Brighten } >
85+ strokeThickness = "1" >
7386 </ IgrTreemap >
7487 </ div >
7588 </ div >
7689 ) ;
7790 }
7891
79- public onHighlightingModeChange ( args : any ) {
80- let value = args . target . value as string ;
81-
82- if ( value === "Brighten" ) {
83- this . treemap . highlightingMode = TreemapHighlightingMode . Brighten ;
84- }
85- else {
86- this . treemap . highlightingMode = TreemapHighlightingMode . FadeOthers ;
87- }
88- }
89-
9092 private _countyHierarchicalData : CountyHierarchicalData = null ;
9193 public get countyHierarchicalData ( ) : CountyHierarchicalData {
9294 if ( this . _countyHierarchicalData == null )
@@ -95,8 +97,19 @@ export default class Sample extends React.Component<any, any> {
9597 }
9698 return this . _countyHierarchicalData ;
9799 }
98- }
99100
101+ private _componentRenderer : ComponentRenderer = null ;
102+ public get renderer ( ) : ComponentRenderer {
103+ if ( this . _componentRenderer == null ) {
104+ this . _componentRenderer = new ComponentRenderer ( ) ;
105+ var context = this . _componentRenderer . context ;
106+ PropertyEditorPanelDescriptionModule . register ( context ) ;
107+ TreemapDescriptionModule . register ( context ) ;
108+ }
109+ return this . _componentRenderer ;
110+ }
111+
112+ }
100113
101114// rendering above component in the React DOM
102115const root = ReactDOM . createRoot ( document . getElementById ( 'root' ) ) ;
0 commit comments