@@ -28,7 +28,12 @@ import {
28
28
import { ErrorMessages , scope , Slots } from "./constants.ts" ;
29
29
import { RetryEvent } from "./events.ts" ;
30
30
import { clear , error , image } from "./icons.ts" ;
31
- import { getProgressUiParams , isFileImage , isStringNumber } from "./utils.ts" ;
31
+ import {
32
+ getProgressUiParams ,
33
+ isFileImage ,
34
+ isStringNumber ,
35
+ loadingConverter ,
36
+ } from "./utils.ts" ;
32
37
import FileInputValidator from "./Validator.ts" ;
33
38
34
39
const BaseClass = withOnReportValidity (
@@ -53,25 +58,7 @@ export class FileInput extends BaseClass {
53
58
* - If `true`, a spinner will appear indicating the component is loading.
54
59
* - If a number between 0 and 100, it shows the percentage of the loading state.
55
60
*/
56
- @property ( {
57
- converter : {
58
- fromAttribute ( value : string | null ) : boolean | number {
59
- if ( value === null ) return false ;
60
- if ( value === "" ) return true ;
61
-
62
- const numericValue = Number ( value ) ;
63
-
64
- if ( Number . isNaN ( numericValue ) ) return true ;
65
-
66
- return numericValue ;
67
- } ,
68
- toAttribute ( value : boolean | number ) : string | null {
69
- if ( typeof value === "boolean" ) return value ? "true" : null ;
70
-
71
- return `${ value } ` ;
72
- } ,
73
- } ,
74
- } )
61
+ @property ( { converter : loadingConverter } )
75
62
public loading : boolean | number = false ;
76
63
77
64
/**
@@ -646,8 +633,6 @@ export class FileInput extends BaseClass {
646
633
}
647
634
648
635
protected override render ( ) {
649
- console . log ( this . loading ) ;
650
-
651
636
const rootClasses = classMap ( {
652
637
root : true ,
653
638
disabled : this . disabled ,
0 commit comments