File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
adminforth/dataConnectors Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
252252 if ( value === "" || value === null ) {
253253 return this . setFieldValue ( field , null ) ;
254254 }
255+ // Accept string
255256 if ( typeof value === "string" ) {
256257 const string = value . trim ( ) ;
257258 if ( ! string ) {
@@ -262,6 +263,13 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
262263 }
263264 throw new Error ( `Value is not a decimal. Field ${ field . name } with type is ${ field . type } , but got value: ${ value } with type ${ typeof value } ` ) ;
264265 }
266+ // Accept Decimal-like objects (e.g., decimal.js) by using toString()
267+ if ( value && typeof value === "object" && typeof ( value as any ) . toString === "function" ) {
268+ const s = ( value as any ) . toString ( ) ;
269+ if ( typeof s === "string" && s . trim ( ) !== "" && Number . isFinite ( Number ( s ) ) ) {
270+ return this . setFieldValue ( field , s ) ;
271+ }
272+ }
265273
266274 throw new Error ( `Value is not a decimal. Field ${ field . name } with type is ${ field . type } , but got value: ${ String ( value ) } with type ${ typeof value } ` ) ;
267275 }
You can’t perform that action at this time.
0 commit comments