Limit nodes opened by default in the JSON Tree component (#11002)
- Add a parameter to choose which nodes to open by default - On the Admin Panel, open all nodes by default - On the Workflow Run step output, open only the two first depths - On the Workflow Run step input, open only the previous step first depth - Display `[empty string]` when a node is an empty string - Now, display `null` instead of `[null]` ## Demo https://github.com/user-attachments/assets/99b3078a-da3c-4330-b0ff-ddb2e360d933 Closes https://github.com/twentyhq/core-team-issues/issues/538
This commit is contained in:
committed by
GitHub
parent
15a2cb5141
commit
1ecc5e2bf6
@ -5,6 +5,7 @@ import { JsonArrow } from '@ui/json-visualizer/components/internal/JsonArrow';
|
||||
import { JsonList } from '@ui/json-visualizer/components/internal/JsonList';
|
||||
import { JsonNodeLabel } from '@ui/json-visualizer/components/internal/JsonNodeLabel';
|
||||
import { JsonNode } from '@ui/json-visualizer/components/JsonNode';
|
||||
import { useJsonTreeContextOrThrow } from '@ui/json-visualizer/hooks/useJsonTreeContextOrThrow';
|
||||
import { ANIMATION } from '@ui/theme';
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { useState } from 'react';
|
||||
@ -49,9 +50,13 @@ export const JsonNestedNode = ({
|
||||
depth: number;
|
||||
keyPath: string;
|
||||
}) => {
|
||||
const { shouldExpandNodeInitially } = useJsonTreeContextOrThrow();
|
||||
|
||||
const hideRoot = !isDefined(label);
|
||||
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
const [isOpen, setIsOpen] = useState(
|
||||
shouldExpandNodeInitially({ keyPath, depth }),
|
||||
);
|
||||
|
||||
const renderedChildren = (
|
||||
<StyledJsonList
|
||||
|
||||
Reference in New Issue
Block a user