22
22
path .abspath (path .dirname (path .dirname (__file__ ))), "templates"
23
23
)
24
24
25
- LABEL_STYLE = {
26
- "fontSize" : "0.875rem" ,
27
- "marginBottom" : "0.3333em"
28
- }
25
+ LABEL_STYLE = {"fontSize" : "0.875rem" , "marginBottom" : "0.3333em" }
29
26
30
27
HEADER_STYLE = {
31
28
"fontSize" : "1rem" ,
32
29
"fontWeight" : "bold" ,
33
30
"margin" : "2rem 0 1rem" ,
34
31
}
35
32
33
+
36
34
def read_localization_yml (file : str , language : str ) -> Dict [str , Any ]:
37
35
"""Reads localization template.
38
36
@@ -119,7 +117,11 @@ def cast_type(val):
119
117
120
118
121
119
def create_number_input (
122
- idx : str , data : Dict [str , Any ], content : Dict [str , str ], defaults : Parameters
120
+ idx : str ,
121
+ data : Dict [str , Any ],
122
+ content : Dict [str , str ],
123
+ defaults : Parameters ,
124
+ debounce : bool = True ,
123
125
):
124
126
"""Returns number formgroup for given form data.
125
127
@@ -128,6 +130,7 @@ def create_number_input(
128
130
data: Input form kwargs.
129
131
content: Localization text
130
132
defaults: Parameters to infer defaults
133
+ debounce: Trigger callback on enter or unfocus
131
134
"""
132
135
input_kwargs = data .copy ()
133
136
input_kwargs .pop ("percent" , None )
@@ -139,7 +142,7 @@ def create_number_input(
139
142
return FormGroup (
140
143
children = [
141
144
Label (html_for = idx , children = content [idx ], style = LABEL_STYLE ),
142
- Input (id = idx , ** input_kwargs ),
145
+ Input (id = idx , debounce = debounce , ** input_kwargs ),
143
146
]
144
147
)
145
148
0 commit comments