File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -85,13 +85,13 @@ const useRecord = (record?: number) => {
85
85
86
86
const getSchemaDefaultValue = ( schema : Schema ) => {
87
87
if ( schema ?. type === 'array' ) return [ ]
88
- if ( schema ?. type === 'boolean' ) return true
89
- if ( schema ?. type === 'date' ) return ''
90
- if ( schema ?. type === 'datetime' ) return ''
91
- if ( schema ?. type === 'number' ) return 0
92
88
if ( schema ?. type === 'object' ) return { }
93
- if ( schema ?. type === 'string' ) return ''
94
- return null
89
+ if ( schema ?. type === 'void' ) {
90
+ for ( let key in schema . properties ) {
91
+ const value = getSchemaDefaultValue ( schema . properties [ key ] )
92
+ if ( isValid ( value ) ) return value
93
+ }
94
+ }
95
95
}
96
96
97
97
const getDefaultValue = ( defaultValue : any , schema : Schema ) => {
Original file line number Diff line number Diff line change @@ -85,13 +85,13 @@ const useRecord = (record?: number) => {
85
85
86
86
const getSchemaDefaultValue = ( schema : Schema ) => {
87
87
if ( schema ?. type === 'array' ) return [ ]
88
- if ( schema ?. type === 'boolean' ) return true
89
- if ( schema ?. type === 'date' ) return ''
90
- if ( schema ?. type === 'datetime' ) return ''
91
- if ( schema ?. type === 'number' ) return 0
92
88
if ( schema ?. type === 'object' ) return { }
93
- if ( schema ?. type === 'string' ) return ''
94
- return null
89
+ if ( schema ?. type === 'void' ) {
90
+ for ( let key in schema . properties ) {
91
+ const value = getSchemaDefaultValue ( schema . properties [ key ] )
92
+ if ( isValid ( value ) ) return value
93
+ }
94
+ }
95
95
}
96
96
97
97
const getDefaultValue = ( defaultValue : any , schema : Schema ) => {
You can’t perform that action at this time.
0 commit comments