diff --git a/src/lib/core/components/View/DynamicView.tsx b/src/lib/core/components/View/DynamicView.tsx index c65a3f3d..ccbc6a2a 100644 --- a/src/lib/core/components/View/DynamicView.tsx +++ b/src/lib/core/components/View/DynamicView.tsx @@ -5,7 +5,7 @@ import {isValidElementType} from 'react-is'; import type {MonacoEditorProps} from 'react-monaco-editor/lib/types'; import {isCorrectSpec} from '../../helpers'; -import {AnyObject, FormValue, Spec} from '../../types'; +import {FormValue, Spec} from '../../types'; import {ViewController} from './ViewController'; import {isCorrectViewConfig} from './helpers'; @@ -13,7 +13,7 @@ import {useCreateContext} from './hooks'; import {DynamicViewConfig} from './types'; export interface DynamicViewProps { - value: AnyObject; + value: FormValue; spec: Spec; config: DynamicViewConfig; Link?: React.ComponentType<{ @@ -31,7 +31,7 @@ export const DynamicView = ({value, spec, config, Link, Monaco}: DynamicViewProp [config, value, Link, Monaco], ); - if (_.isObjectLike(value) && isCorrectSpec(spec) && isCorrectViewConfig(config)) { + if (isCorrectSpec(spec) && isCorrectViewConfig(config)) { return ( diff --git a/src/lib/core/components/View/types/context.ts b/src/lib/core/components/View/types/context.ts index 73492d7a..e4474f00 100644 --- a/src/lib/core/components/View/types/context.ts +++ b/src/lib/core/components/View/types/context.ts @@ -2,13 +2,13 @@ import React from 'react'; import type {MonacoEditorProps} from 'react-monaco-editor/lib/types'; -import {AnyObject, FormValue, Spec} from '../../../types'; +import {FormValue, Spec} from '../../../types'; import {DynamicViewConfig} from './'; export interface DynamicViewContext { config: DynamicViewConfig; - value: AnyObject; + value: FormValue; Link?: React.ComponentType<{ value: FormValue; link: Spec['viewSpec']['link']; diff --git a/src/stories/components/DynamicView/DynamicView.tsx b/src/stories/components/DynamicView/DynamicView.tsx index 0dbe1449..38d83844 100644 --- a/src/stories/components/DynamicView/DynamicView.tsx +++ b/src/stories/components/DynamicView/DynamicView.tsx @@ -3,8 +3,8 @@ import React from 'react'; import MonacoEditor from 'react-monaco-editor'; import { - AnyObject, DynamicView as BaseDynamicView, + FormValue, Spec, dynamicViewConfig, prepareSpec, @@ -13,7 +13,7 @@ import { import {DynLink} from './DynLink'; export interface DynamicViewProps { - value: AnyObject; + value: FormValue; spec: Spec; } diff --git a/src/stories/components/InputPreview/InputPreview.tsx b/src/stories/components/InputPreview/InputPreview.tsx index aad67498..13a76105 100644 --- a/src/stories/components/InputPreview/InputPreview.tsx +++ b/src/stories/components/InputPreview/InputPreview.tsx @@ -7,7 +7,7 @@ import MonacoEditor from 'react-monaco-editor'; import type {MonacoEditorProps} from 'react-monaco-editor/lib/types'; import {DynamicField, DynamicView} from '../'; -import {FormValue, MonacoInput, MonacoInputBaseProps, Spec, SpecTypes} from '../../../lib'; +import {FormValue, MonacoInput, MonacoInputBaseProps, Spec} from '../../../lib'; import {cn} from '../../../lib/kit/utils/cn'; import {getOptionsSpec, transformCorrect, transformIncorrect} from './utils'; @@ -86,18 +86,6 @@ export const InputPreview: React.FC = ({ [externalSpec, excludeOptions], ); - const getViewProps = React.useCallback( - (values: FormValue, spec: Spec) => ({ - value: {'__any-name': values}, - spec: { - type: SpecTypes.Object, - properties: {'__any-name': spec}, - viewSpec: {type: 'base'}, - }, - }), - [], - ); - const searchFunction = React.useCallback( (spec: Spec) => Boolean( @@ -176,10 +164,8 @@ export const InputPreview: React.FC = ({
{togglerInput === 'json' ? (