File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ export const fieldObject = (
17
17
if ( typeof schema . properties !== 'object' )
18
18
return widgets . callout ?.( { id : '' , message : error } ) ?? html `${ error } ` ;
19
19
20
+ const id = path . join ( '.' ) ;
21
+
22
+ function missing ( widgetName : string ) {
23
+ const options = { id, message : `Missing ${ widgetName } widget.` } ;
24
+ return widgets ?. callout ?.( options ) ?? html `< p > ${ options . message } </ p > ` ;
25
+ }
26
+
20
27
const children = Object . entries ( schema . properties ) . map (
21
28
( [ propName , propValue ] ) => {
22
29
if ( Array . isArray ( propValue ) || typeof propValue === 'boolean' )
@@ -59,13 +66,18 @@ export const fieldObject = (
59
66
if ( typeof uiSchema ?. [ 'ui:title' ] === 'string' ) label = uiSchema [ 'ui:title' ] ;
60
67
61
68
const options = {
62
- id : path . join ( '.' ) ,
69
+ id,
63
70
label,
64
71
helpText : schema . description ,
65
72
children,
66
73
level,
67
74
} ;
68
75
76
+ if ( typeof uiSchema ?. [ 'ui:widget' ] === 'string' ) {
77
+ const customWidgetName = uiSchema ?. [ 'ui:widget' ] ;
78
+ return widgets ?. [ customWidgetName ] ?.( options ) || missing ( customWidgetName ) ;
79
+ }
80
+
69
81
return (
70
82
widgets ?. object ?.( options ) ??
71
83
widgets ?. callout ?.( { id : '' , message : error } ) ??
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ export const fieldPrimitive = (
189
189
if ( typeof uiOptions ?. [ 'ui:widget' ] === 'string' ) {
190
190
const customWidgetName = uiOptions ?. [ 'ui:widget' ] ;
191
191
if ( customWidgetName !== 'password' ) {
192
- return widgets ?. [ customWidgetName ] ?.( options ) || missing ( 'custom' ) ;
192
+ return widgets ?. [ customWidgetName ] ?.( options ) || missing ( customWidgetName ) ;
193
193
}
194
194
}
195
195
You can’t perform that action at this time.
0 commit comments