@@ -134,10 +134,20 @@ export const fieldPrimitive = (
134134 }
135135
136136 if ( schema . type === 'string' ) {
137+ let inputType = 'text' ;
138+ if ( schema . format === 'password' || schema . format === 'email' ) {
139+ inputType = schema . format ;
140+ }
141+
142+ if ( uiOptions ?. [ 'ui:options' ] ?. inputType === 'tel' ) {
143+ inputType = 'tel' ;
144+ }
137145 const options = {
138146 ...baseOptions ,
139147 value : baseValue ? String ( baseValue ) : '' ,
140148
149+ inputType,
150+
141151 minLength : schema . minLength ,
142152 maxLength : schema . maxLength ,
143153 pattern : schema . pattern ,
@@ -146,6 +156,10 @@ export const fieldPrimitive = (
146156 if ( uiOptions ?. [ 'ui:widget' ] === 'textarea' ) {
147157 return widgets ?. textarea ?.( options ) || missing ( 'textarea' ) ;
148158 }
159+ if ( typeof uiOptions ?. [ 'ui:widget' ] === 'string' ) {
160+ const customWidgetName = uiOptions ?. [ 'ui:widget' ] ;
161+ return widgets ?. [ customWidgetName ] ?.( options ) || missing ( 'custom' ) ;
162+ }
149163
150164 return widgets ?. text ?.( options ) || missing ( 'text' ) ;
151165 }
@@ -205,3 +219,36 @@ export const fieldPrimitive = (
205219
206220 return missing ( `Wrong input for: ${ path . join ( '/' ) } ` ) ;
207221} ;
222+
223+ /*
224+
225+ AJV-Formats
226+ https://ajv.js.org/packages/ajv-formats.html
227+
228+ date: full-date according to RFC3339 (opens new window).
229+ time: time (time-zone is mandatory).
230+ date-time: date-time (time-zone is mandatory).
231+ iso-time: time with optional time-zone.
232+ iso-date-time: date-time with optional time-zone.
233+ duration: duration from RFC3339(opens new window)
234+ uri: full URI.
235+ uri-reference: URI reference, including full and relative URIs.
236+ uri-template: URI template according to RFC6570(opens new window)
237+ url (deprecated): URL record (opens new window).
238+ email: email address.
239+ hostname: host name according to RFC1034 (opens new window).
240+ ipv4: IP address v4.
241+ ipv6: IP address v6.
242+ regex: tests whether a string is a valid regular expression by passing it to RegExp constructor.
243+ uuid: Universally Unique IDentifier according to RFC4122 (opens new window).
244+ json-pointer: JSON-pointer according to RFC6901 (opens new window).
245+ relative-json-pointer: relative JSON-pointer according to this draft (opens new window).
246+ byte: base64 encoded data according to the openApi 3.0.0 specification(opens new window)
247+ int32: signed 32 bits integer according to the openApi 3.0.0 specification(opens new window)
248+ int64: signed 64 bits according to the openApi 3.0.0 specification(opens new window)
249+ float: float according to the openApi 3.0.0 specification(opens new window)
250+ double: double according to the openApi 3.0.0 specification(opens new window)
251+ password: password string according to the openApi 3.0.0 specification(opens new window)
252+ binary: binary string according to the openApi 3.0.0 specification
253+
254+ */
0 commit comments