fix(json-schema-2020-12): expand deeply all Schema Objects and complex keywords (#9581)
Refs #9508 Supersedes #9510 Co-authored-by: Julien Bourges <julien.bourges@actility.com>
This commit is contained in:
@@ -5,13 +5,14 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import { useComponent, useIsExpanded, useIsExpandedDeeply } from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const $defs = ({ schema }) => {
|
||||
const $defs = schema?.$defs || {}
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
@@ -5,11 +5,16 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../../prop-types"
|
||||
import { useComponent, useIsExpandedDeeply } from "../../../hooks"
|
||||
import {
|
||||
useComponent,
|
||||
useIsExpanded,
|
||||
useIsExpandedDeeply,
|
||||
} from "../../../hooks"
|
||||
|
||||
const $vocabulary = ({ schema }) => {
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const Accordion = useComponent("Accordion")
|
||||
|
||||
const handleExpansion = useCallback(() => {
|
||||
|
||||
@@ -5,14 +5,20 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useFn, useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import {
|
||||
useFn,
|
||||
useComponent,
|
||||
useIsExpanded,
|
||||
useIsExpandedDeeply,
|
||||
} from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const AllOf = ({ schema }) => {
|
||||
const allOf = schema?.allOf || []
|
||||
const fn = useFn()
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
@@ -5,14 +5,20 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useFn, useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import {
|
||||
useFn,
|
||||
useComponent,
|
||||
useIsExpanded,
|
||||
useIsExpandedDeeply,
|
||||
} from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const AnyOf = ({ schema }) => {
|
||||
const anyOf = schema?.anyOf || []
|
||||
const fn = useFn()
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
@@ -5,13 +5,14 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import { useComponent, useIsExpanded, useIsExpandedDeeply } from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const DependentSchemas = ({ schema }) => {
|
||||
const dependentSchemas = schema?.dependentSchemas || []
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
@@ -5,14 +5,20 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useFn, useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import {
|
||||
useFn,
|
||||
useComponent,
|
||||
useIsExpanded,
|
||||
useIsExpandedDeeply,
|
||||
} from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const OneOf = ({ schema }) => {
|
||||
const oneOf = schema?.oneOf || []
|
||||
const fn = useFn()
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
@@ -5,14 +5,20 @@ import React, { useCallback, useState } from "react"
|
||||
import classNames from "classnames"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
import { useFn, useComponent, useIsExpandedDeeply } from "../../hooks"
|
||||
import {
|
||||
useFn,
|
||||
useComponent,
|
||||
useIsExpandedDeeply,
|
||||
useIsExpanded,
|
||||
} from "../../hooks"
|
||||
import { JSONSchemaDeepExpansionContext } from "../../context"
|
||||
|
||||
const PrefixItems = ({ schema }) => {
|
||||
const prefixItems = schema?.prefixItems || []
|
||||
const fn = useFn()
|
||||
const isExpanded = useIsExpanded()
|
||||
const isExpandedDeeply = useIsExpandedDeeply()
|
||||
const [expanded, setExpanded] = useState(isExpandedDeeply)
|
||||
const [expanded, setExpanded] = useState(isExpanded || isExpandedDeeply)
|
||||
const [expandedDeeply, setExpandedDeeply] = useState(false)
|
||||
const Accordion = useComponent("Accordion")
|
||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||
|
||||
Reference in New Issue
Block a user