Skip to content

Commit

Permalink
fix: for input preview monaco value and change multi one of stories
Browse files Browse the repository at this point in the history
  • Loading branch information
NasgulNexus committed Aug 10, 2023
1 parent 9fc2788 commit a15419a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions src/stories/ObjectMultiOneOf.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
const spec: ObjectSpec = {
type: SpecTypes.Object,
properties: {
external: {
person: {
required: true,
type: SpecTypes.Object,
properties: {
Expand All @@ -26,25 +26,26 @@ const spec: ObjectSpec = {
type: SpecTypes.Number,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Age'},
},
license: {
type: SpecTypes.Boolean,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'License'},
},
},
viewSpec: {
type: 'base',
layoutTitle: 'Person data',
},
},
internal: {
id: {
required: true,
type: SpecTypes.String,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Person id'},
},
license: {
required: true,
type: SpecTypes.Boolean,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'license'},
},
},
description: {
external: 'External candidate',
internal: 'Internal candidate',
person: 'Person Data',
id: 'Person id',
license: 'License',
},
viewSpec: {
type: 'multi_oneof',
Expand All @@ -57,10 +58,9 @@ const spec: ObjectSpec = {
const excludeOptions = ['items', 'viewSpec.type', 'viewSpec.itemLabel', 'viewSpec.table'];

const value = {
external: {
person: {
name: 'Bar',
age: 12345,
license: true,
age: 20,
},
};

Expand Down
24 changes: 12 additions & 12 deletions src/stories/ObjectMultiOneOfFlat.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
const spec: ObjectSpec = {
type: SpecTypes.Object,
properties: {
external: {
person: {
required: true,
type: SpecTypes.Object,
properties: {
Expand All @@ -26,25 +26,26 @@ const spec: ObjectSpec = {
type: SpecTypes.Number,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Age'},
},
license: {
type: SpecTypes.Boolean,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'License'},
},
},
viewSpec: {
type: 'base',
layoutTitle: 'Person data',
},
},
internal: {
id: {
required: true,
type: SpecTypes.String,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'Person id'},
},
license: {
required: true,
type: SpecTypes.Boolean,
viewSpec: {type: 'base', layout: 'row', layoutTitle: 'license'},
},
},
description: {
external: 'External candidate',
internal: 'Internal candidate',
person: 'Person Data',
id: 'Person id',
license: 'License',
},
viewSpec: {
type: 'multi_oneof_flat',
Expand All @@ -57,10 +58,9 @@ const spec: ObjectSpec = {
const excludeOptions = ['items', 'viewSpec.type', 'viewSpec.itemLabel', 'viewSpec.table'];

const value = {
external: {
person: {
name: 'Bar',
age: 12345,
license: true,
age: 20,
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/stories/components/InputPreview/InputPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const InputPreview: React.FC<InputPreviewProps> = ({
const renderMonaco = React.useCallback((value: FormValue) => {
const monacoProps = {
input: {
value: JSON.stringify(value, null, 2),
value: JSON.stringify(value, (_, value) => (value === undefined ? null : value), 2),
onChange: _.noop,
},
spec: {viewSpec: {monacoParams: {language: 'json', fontSize: 11}, disabled: true}},
Expand Down

0 comments on commit a15419a

Please sign in to comment.