94
94
TIME = "time"
95
95
COLOR = "color"
96
96
DATETIME_LOCAL = "datetime-local"
97
+ DATETIME = DATETIME_LOCAL
97
98
98
99
CHECKBOX = 'checkbox'
99
100
RADIO = 'radio'
100
101
SELECT = 'select'
101
102
TEXTAREA = 'textarea'
102
103
103
104
__all__ = ['TEXT' , 'NUMBER' , 'FLOAT' , 'PASSWORD' , 'URL' , 'DATE' ,
104
- 'TIME' , 'COLOR' , 'DATETIME_LOCAL' , 'input' , 'textarea' ,
105
+ 'TIME' , 'COLOR' , 'DATETIME_LOCAL' , 'DATETIME' , ' input' , 'textarea' ,
105
106
'select' , 'checkbox' , 'radio' , 'actions' , 'file_upload' ,
106
107
'slider' , 'input_group' , 'input_update' ]
107
108
@@ -133,16 +134,18 @@ def _parse_args(kwargs, excludes=()):
133
134
return kwargs , valid_func , onchange_func
134
135
135
136
136
- def input (label : str = '' , type : str = TEXT , * , validate : Callable [[Any ], Optional [str ]] = None , name : str = None , value : str = None ,
137
- action : Tuple [str , Callable [[Callable ], None ]] = None , onchange : Callable [[Any ], None ] = None , placeholder : str = None , required : bool = None ,
137
+ def input (label : str = '' , type : str = TEXT , * , validate : Callable [[Any ], Optional [str ]] = None , name : str = None ,
138
+ value : str = None ,
139
+ action : Tuple [str , Callable [[Callable ], None ]] = None , onchange : Callable [[Any ], None ] = None ,
140
+ placeholder : str = None , required : bool = None ,
138
141
readonly : bool = None , datalist : List [str ] = None , help_text : str = None , ** other_html_attrs ):
139
142
r"""Text input
140
143
141
144
:param str label: Label of input field.
142
- :param str type: Input type. Currently, supported types are:`TEXT` , `NUMBER` , `FLOAT` , `PASSWORD` , `URL` , `DATE` , `TIME`, `COLOR `, `DATETIME_LOCAL `
145
+ :param str type: Input type. Currently, supported types are:`TEXT` , `NUMBER` , `FLOAT` , `PASSWORD` , `URL` , `DATE` , `TIME`, `DATETIME `, `COLOR `
143
146
144
- Note that `DATE` and `TIME` type are not supported on some browsers,
145
- for details see https://developer.mozilla .org/en-US/docs/Web/HTML/Element/input#Browser_compatibility
147
+ The value of `DATE` , `TIME`, `DATETIME` type is a string in the format of `YYYY-MM-DD` , `HH:MM:SS` , `YYYY-MM-DDTHH:MM` respectively
148
+ (`%Y-%m-%d`, `%H:%M:%S`, `%Y-%m-%dT%H:%M` in python `strptime() < https://docs.python .org/3/library/datetime.html#strftime-and-strptime-behavior>`_ format).
146
149
:param callable validate: Input value validation function. If provided, the validation function will be called when
147
150
user completes the input field or submits the form.
148
151
@@ -263,9 +266,12 @@ def preprocess_func(d): # Convert the original data submitted by the user
263
266
return single_input (item_spec , valid_func , preprocess_func , onchange_func )
264
267
265
268
266
- def textarea (label : str = '' , * , rows : int = 6 , code : Union [bool , Dict ] = None , maxlength : int = None , minlength : int = None ,
267
- validate : Callable [[Any ], Optional [str ]] = None , name : str = None , value : str = None , onchange : Callable [[Any ], None ] = None ,
268
- placeholder : str = None , required : bool = None , readonly : bool = None , help_text : str = None , ** other_html_attrs ):
269
+ def textarea (label : str = '' , * , rows : int = 6 , code : Union [bool , Dict ] = None , maxlength : int = None ,
270
+ minlength : int = None ,
271
+ validate : Callable [[Any ], Optional [str ]] = None , name : str = None , value : str = None ,
272
+ onchange : Callable [[Any ], None ] = None ,
273
+ placeholder : str = None , required : bool = None , readonly : bool = None , help_text : str = None ,
274
+ ** other_html_attrs ):
269
275
r"""Text input area (multi-line text input)
270
276
271
277
:param int rows: The number of visible text lines for the input area. Scroll bar will be used when content exceeds.
@@ -379,7 +385,8 @@ def select(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, str
379
385
return single_input (item_spec , valid_func = valid_func , preprocess_func = lambda d : d , onchange_func = onchange_func )
380
386
381
387
382
- def checkbox (label : str = '' , options : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , * , inline : bool = None , validate : Callable [[Any ], Optional [str ]] = None ,
388
+ def checkbox (label : str = '' , options : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , * , inline : bool = None ,
389
+ validate : Callable [[Any ], Optional [str ]] = None ,
383
390
name : str = None , value : List = None , onchange : Callable [[Any ], None ] = None , help_text : str = None ,
384
391
** other_html_attrs ):
385
392
r"""A group of check box that allowing single values to be selected/deselected.
@@ -402,7 +409,8 @@ def checkbox(label: str = '', options: List[Union[Dict[str, Any], Tuple, List, s
402
409
return single_input (item_spec , valid_func , lambda d : d , onchange_func )
403
410
404
411
405
- def radio (label : str = '' , options : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , * , inline : bool = None , validate : Callable [[Any ], Optional [str ]] = None ,
412
+ def radio (label : str = '' , options : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , * , inline : bool = None ,
413
+ validate : Callable [[Any ], Optional [str ]] = None ,
406
414
name : str = None , value : str = None , onchange : Callable [[Any ], None ] = None , required : bool = None ,
407
415
help_text : str = None , ** other_html_attrs ):
408
416
r"""A group of radio button. Only a single button can be selected.
@@ -467,7 +475,8 @@ def _parse_action_buttons(buttons):
467
475
return act_res
468
476
469
477
470
- def actions (label : str = '' , buttons : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , name : str = None , help_text : str = None ):
478
+ def actions (label : str = '' , buttons : List [Union [Dict [str , Any ], Tuple , List , str ]] = None , name : str = None ,
479
+ help_text : str = None ):
471
480
r"""Actions selection
472
481
473
482
It is displayed as a group of buttons on the page. After the user clicks the button of it,
@@ -673,7 +682,8 @@ def slider(label: str = '', *, name: str = None, value: Union[int, float] = 0, m
673
682
return single_input (item_spec , valid_func , lambda d : d , onchange_func )
674
683
675
684
676
- def input_group (label : str = '' , inputs : List = None , validate : Callable [[Dict ], Optional [Tuple [str , str ]]] = None , cancelable : bool = False ):
685
+ def input_group (label : str = '' , inputs : List = None , validate : Callable [[Dict ], Optional [Tuple [str , str ]]] = None ,
686
+ cancelable : bool = False ):
677
687
r"""Input group. Request a set of inputs from the user at once.
678
688
679
689
:param str label: Label of input group.
0 commit comments