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 = (
1717 if ( typeof schema . properties !== 'object' )
1818 return widgets . callout ?.( { id : '' , message : error } ) ?? html `${ error } ` ;
1919
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+
2027 const children = Object . entries ( schema . properties ) . map (
2128 ( [ propName , propValue ] ) => {
2229 if ( Array . isArray ( propValue ) || typeof propValue === 'boolean' )
@@ -59,13 +66,18 @@ export const fieldObject = (
5966 if ( typeof uiSchema ?. [ 'ui:title' ] === 'string' ) label = uiSchema [ 'ui:title' ] ;
6067
6168 const options = {
62- id : path . join ( '.' ) ,
69+ id,
6370 label,
6471 helpText : schema . description ,
6572 children,
6673 level,
6774 } ;
6875
76+ if ( typeof uiSchema ?. [ 'ui:widget' ] === 'string' ) {
77+ const customWidgetName = uiSchema ?. [ 'ui:widget' ] ;
78+ return widgets ?. [ customWidgetName ] ?.( options ) || missing ( customWidgetName ) ;
79+ }
80+
6981 return (
7082 widgets ?. object ?.( options ) ??
7183 widgets ?. callout ?.( { id : '' , message : error } ) ??
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ export const fieldPrimitive = (
189189 if ( typeof uiOptions ?. [ 'ui:widget' ] === 'string' ) {
190190 const customWidgetName = uiOptions ?. [ 'ui:widget' ] ;
191191 if ( customWidgetName !== 'password' ) {
192- return widgets ?. [ customWidgetName ] ?.( options ) || missing ( 'custom' ) ;
192+ return widgets ?. [ customWidgetName ] ?.( options ) || missing ( customWidgetName ) ;
193193 }
194194 }
195195
You can’t perform that action at this time.
0 commit comments