@@ -363,7 +363,7 @@ export default function Demo() {
363
363
}
364
364
```
365
365
366
- Supports certain partial customizations such as: ` <Copied /> ` , ` <CountInfo /> ` , ` <CountInfoExtra /> ` , ` <Ellipsis /> ` , ` <KeyName /> `
366
+ Supports certain partial customizations such as: ` <Copied /> ` , ` <CountInfo /> ` , ` <CountInfoExtra /> ` , ` <Ellipsis /> ` , ` <KeyName /> ` , ` <Row /> `
367
367
368
368
``` tsx mdx:preview
369
369
import React , { Fragment } from ' react' ;
@@ -580,6 +580,52 @@ Passing **as="tagName"** will automatically infer the type.
580
580
/>
581
581
```
582
582
583
+ Add a click event on the data row
584
+
585
+ ``` tsx mdx:preview
586
+ import React from ' react' ;
587
+ import JsonView from ' @uiw/react-json-view' ;
588
+
589
+ export default function Demo() {
590
+ return (
591
+ <JsonView
592
+ style = { {
593
+ ' --w-rjv-background-color' : ' #ffffff' ,
594
+ }}
595
+ value = { {
596
+ name: ' John' ,
597
+ age: 30 ,
598
+ hobbies: [' reading' , ' coding' , ' swimming' ],
599
+ address: {
600
+ street: ' 123 Main St' ,
601
+ city: ' New York' ,
602
+ country: {
603
+ name: ' Main ' ,
604
+ codex: ' 123'
605
+ }
606
+ }
607
+ }}
608
+ >
609
+ <JsonView.Row
610
+ as = " div"
611
+ render = { (props , { keyName , value , parentValue }) => {
612
+ return (
613
+ <div
614
+ { ... props }
615
+ onClick = { () => {
616
+ console .log (" keyName" , keyName )
617
+ console .log (" value" , value )
618
+ console .log (" parentValue" , parentValue )
619
+ }}
620
+ />
621
+ )
622
+ }}
623
+ />
624
+ </JsonView >
625
+ )
626
+ }
627
+ ```
628
+
583
629
## Highlight Updates
584
630
585
631
``` tsx mdx:preview
@@ -777,6 +823,7 @@ import { Arrow } from './symbol/Arrow';
777
823
import { Colon } from ' ./symbol/Colon' ;
778
824
import { Quote } from ' ./symbol/Quote' ;
779
825
import { ValueQuote } from ' ./symbol/ValueQuote' ;
826
+
780
827
import { Bigint } from ' ./types/Bigint' ;
781
828
import { Date } from ' ./types/Date' ;
782
829
import { False } from ' ./types/False' ;
@@ -790,13 +837,24 @@ import { StringText } from './types/String';
790
837
import { True } from ' ./types/True' ;
791
838
import { Undefined } from ' ./types/Undefined' ;
792
839
import { Url } from ' ./types/Url' ;
840
+
793
841
import { Copied } from ' ./section/Copied' ;
794
842
import { CountInfo } from ' ./section/CountInfo' ;
795
843
import { CountInfoExtra } from ' ./section/CountInfoExtra' ;
796
844
import { Ellipsis } from ' ./section/Ellipsis' ;
797
845
import { KeyName } from ' ./section/KeyName' ;
846
+ import { Row } from ' ./section/Row' ;
798
847
799
848
type JsonViewComponent = React .FC <React .PropsWithRef <JsonViewProps <object >>> & {
849
+ BraceLeft: typeof BraceLeft ;
850
+ BraceRight: typeof BraceRight ;
851
+ BracketsLeft: typeof BracketsLeft ;
852
+ BracketsRight: typeof BracketsRight ;
853
+ Arrow: typeof Arrow ;
854
+ Colon: typeof Colon ;
855
+ Quote: typeof Quote ;
856
+ ValueQuote: typeof ValueQuote ;
857
+
800
858
Bigint: typeof Bigint ;
801
859
Date: typeof Date ;
802
860
False: typeof False ;
@@ -810,19 +868,13 @@ type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
810
868
True: typeof True ;
811
869
Undefined: typeof Undefined ;
812
870
Url: typeof Url ;
813
- BraceLeft: typeof BraceLeft ;
814
- BraceRight: typeof BraceRight ;
815
- BracketsLeft: typeof BracketsLeft ;
816
- BracketsRight: typeof BracketsRight ;
817
- Colon: typeof Colon ;
818
- Ellipsis: typeof Ellipsis ;
819
- Quote: typeof Quote ;
820
- ValueQuote: typeof ValueQuote ;
821
- Arrow: typeof Arrow ;
871
+
822
872
Copied: typeof Copied ;
823
873
CountInfo: typeof CountInfo ;
824
874
CountInfoExtra: typeof CountInfoExtra ;
875
+ Ellipsis: typeof Ellipsis ;
825
876
KeyName: typeof KeyName ;
877
+ Row: typeof Row ;
826
878
};
827
879
declare const JsonView: JsonViewComponent ;
828
880
export default JsonView ;
0 commit comments