@@ -300,7 +300,7 @@ export default function Demo() {
300
300
301
301
## Render
302
302
303
- ** ` v2 ` ** version allows flexible customization of each "part" by providing small sub-components for customization, including value and type components: ` <Bigint /> ` , ` <Date /> ` , ` <False /> ` , ` <Float /> ` , ` <Int /> ` , ` <Map /> ` , ` <Nan /> ` , ` <Null /> ` , ` <Set /> ` , ` <String /> ` , ` <True /> ` , ` <Undefined /> ` , ` <Url /> ` , and symbol components: ` <ValueQuote /> ` , ` <Arrow /> ` , ` <Colon /> ` , ` <Quote /> ` , ` <Ellipsis /> ` , ` < BraceLeft />` , ` <BraceRight /> ` , ` <BracketsLeft /> ` , ` <BracketsRight /> ` .
303
+ ** ` v2 ` ** version allows flexible customization of each "part" by providing small sub-components for customization, including value and type components: ` <Bigint /> ` , ` <Date /> ` , ` <False /> ` , ` <Float /> ` , ` <Int /> ` , ` <Map /> ` , ` <Nan /> ` , ` <Null /> ` , ` <Set /> ` , ` <String /> ` , ` <True /> ` , ` <Undefined /> ` , ` <Url /> ` , and symbol components: ` <ValueQuote /> ` , ` <Arrow /> ` , ` <Colon /> ` , ` <Quote /> ` , ` <BraceLeft /> ` , ` <BraceRight /> ` , ` <BracketsLeft /> ` , ` <BracketsRight /> ` .
304
304
305
305
``` tsx mdx:preview
306
306
import React from ' react' ;
@@ -361,7 +361,7 @@ export default function Demo() {
361
361
}
362
362
```
363
363
364
- Supports certain partial customizations such as: ` Copied ` , ` CountInfo ` , ` CountInfoExtra `
364
+ Supports certain partial customizations such as: ` < Copied /> ` , ` < CountInfo /> ` , ` < CountInfoExtra /> ` , ` <Ellipsis /> ` , ` <KeyName /> `
365
365
366
366
``` tsx mdx:preview
367
367
import React , { Fragment } from ' react' ;
@@ -464,6 +464,8 @@ const Quote = JsonView.Quote;
464
464
const BraceLeft = JsonView .BraceLeft ;
465
465
const BraceRight = JsonView .BraceRight ;
466
466
const CountInfo = JsonView .CountInfo ;
467
+ const Ellipsis = JsonView .Ellipsis ;
468
+ const CountInfoExtra = JsonView .CountInfoExtra ;
467
469
468
470
export default function Demo() {
469
471
return (
@@ -473,6 +475,19 @@ export default function Demo() {
473
475
enableClipboard = { false }
474
476
displayDataTypes = { false }
475
477
>
478
+ <Ellipsis
479
+ render = { ({ ' data-expanded' : isExpanded , className , ... props }, { value }) => {
480
+ if (Array .isArray (value ) && isExpanded ) {
481
+ console .log (' props:' ,value , isExpanded , props )
482
+ return (
483
+ <span className = { className } >
484
+ { Array .from ({ length: value .length }, () => ' Object' ).join (' , ' )}
485
+ </span >
486
+ )
487
+ }
488
+ return <span />;
489
+ }}
490
+ />
476
491
<Quote >
477
492
<span />
478
493
</Quote >
@@ -656,29 +671,32 @@ export default function Demo() {
656
671
## Props
657
672
658
673
``` ts
659
- import { BraceLeft } from " ./symbol/BraceLeft" ;
660
- import { BraceRight } from " ./symbol/BraceRight" ;
674
+ import { BraceLeft } from ' ./symbol/BraceLeft' ;
675
+ import { BraceRight } from ' ./symbol/BraceRight' ;
661
676
import { BracketsLeft } from ' ./symbol/BracketsLeft' ;
662
677
import { BracketsRight } from ' ./symbol/BracketsRight' ;
663
- import { Arrow } from " ./symbol/Arrow" ;
664
- import { Colon } from " ./symbol/Colon" ;
678
+ import { Arrow } from ' ./symbol/Arrow' ;
679
+ import { Colon } from ' ./symbol/Colon' ;
665
680
import { Ellipsis } from ' ./symbol/Ellipsis' ;
666
- import { Quote } from " ./symbol/Quote" ;
681
+ import { Quote } from ' ./symbol/Quote' ;
667
682
import { ValueQuote } from ' ./symbol/ValueQuote' ;
668
- import { Bigint } from " ./types/Bigint" ;
669
- import { Date } from " ./types/Date" ;
670
- import { False } from " ./types/False" ;
671
- import { Float } from " ./types/Float" ;
672
- import { Int } from " ./types/Int" ;
673
- import { Map } from " ./types/Map" ;
674
- import { Nan } from " ./types/Nan" ;
675
- import { Null } from " ./types/Null" ;
676
- import { Set } from " ./types/Set" ;
677
- import { StringText } from " ./types/String" ;
678
- import { True } from " ./types/True" ;
679
- import { Undefined } from " ./types/Undefined" ;
680
- import { Url } from " ./types/Url" ;
681
- import { CountInfo } from " ./section/CountInfo" ;
683
+ import { Bigint } from ' ./types/Bigint' ;
684
+ import { Date } from ' ./types/Date' ;
685
+ import { False } from ' ./types/False' ;
686
+ import { Float } from ' ./types/Float' ;
687
+ import { Int } from ' ./types/Int' ;
688
+ import { Map } from ' ./types/Map' ;
689
+ import { Nan } from ' ./types/Nan' ;
690
+ import { Null } from ' ./types/Null' ;
691
+ import { Set } from ' ./types/Set' ;
692
+ import { StringText } from ' ./types/String' ;
693
+ import { True } from ' ./types/True' ;
694
+ import { Undefined } from ' ./types/Undefined' ;
695
+ import { Url } from ' ./types/Url' ;
696
+ import { Copied } from ' ./section/Copied' ;
697
+ import { CountInfo } from ' ./section/CountInfo' ;
698
+ import { CountInfoExtra } from ' ./section/CountInfoExtra' ;
699
+ import { KeyName } from ' ./section/KeyName' ;
682
700
import { type CountInfoProps } from " ./comps/CountInfo" ;
683
701
import { type CopiedOption } from " ./comps/Copied" ;
684
702
import { type NestedOpenProps } from " ./comps/NestedOpen" ;
@@ -735,7 +753,10 @@ type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
735
753
Quote: typeof Quote ;
736
754
ValueQuote: typeof ValueQuote ;
737
755
Arrow: typeof Arrow ;
756
+ Copied: typeof Copied ;
738
757
CountInfo: typeof CountInfo ;
758
+ CountInfoExtra: typeof CountInfoExtra ;
759
+ KeyName: typeof KeyName ;
739
760
};
740
761
declare const JsonView: JsonViewComponent ;
741
762
export default JsonView ;
0 commit comments