File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,7 @@ function App() {
330330 }
331331 showErrorMessages = { dataDefinition . showErrorMessages }
332332 collapse = { collapseLevel }
333+ // collapseAnimationTime={100}
333334 showCollectionCount = {
334335 showCount === 'Yes' ? true : showCount === 'When closed' ? 'when-closed' : false
335336 }
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ const Editor: React.FC<JsonEditorProps> = ({
3737 enableClipboard = true ,
3838 indent = 3 ,
3939 collapse = false ,
40+ collapseAnimationTime,
4041 showCollectionCount = true ,
4142 restrictEdit = false ,
4243 restrictDelete = false ,
@@ -72,6 +73,17 @@ const Editor: React.FC<JsonEditorProps> = ({
7273
7374 const [ data , setData ] = useData < JsonData > ( { setData : srcSetData , data : srcData } )
7475
76+ const docRoot = document . querySelector ( ':root' ) as HTMLElement
77+ const transitionTime = getComputedStyle ( document . documentElement ) . getPropertyValue (
78+ '--jer-expand-transition-time'
79+ )
80+ if (
81+ collapseAnimationTime !== undefined &&
82+ parseFloat ( transitionTime ) * 1000 !== collapseAnimationTime
83+ ) {
84+ docRoot ?. style . setProperty ( '--jer-expand-transition-time' , `${ collapseAnimationTime / 1000 } s` )
85+ }
86+
7587 useEffect ( ( ) => {
7688 const debounce = setTimeout ( ( ) => setDebouncedSearchText ( searchText ) , searchDebounceTime )
7789 return ( ) => clearTimeout ( debounce )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export interface JsonEditorProps {
2222 id ?: string
2323 indent ?: number
2424 collapse ?: boolean | number | FilterFunction
25+ collapseAnimationTime ?: number // ms
2526 showCollectionCount ?: boolean | 'when-closed'
2627 restrictEdit ?: boolean | FilterFunction
2728 restrictDelete ?: boolean | FilterFunction
You can’t perform that action at this time.
0 commit comments