@@ -251,7 +251,7 @@ def create_docstring(component_name, props, description):
251
251
else prop ['flowType' ],
252
252
required = prop ['required' ],
253
253
description = prop ['description' ],
254
- default = prop .get ('defaultValue' , { 'value' : '' })[ 'value' ] ,
254
+ default = prop .get ('defaultValue' ) ,
255
255
indent_num = 0 ,
256
256
is_flow_type = 'flowType' in prop and 'type' not in prop )
257
257
for p , prop in list (filter_props (props ).items ())))
@@ -410,8 +410,10 @@ def create_prop_docstring(prop_name, type_object, required, description,
410
410
Component is required?
411
411
description: str
412
412
Dash component description
413
- default: str
414
- Default value for prop
413
+ default: dict
414
+ Either None if a default value is not defined, or
415
+ dict containing the key 'value' that defines a
416
+ default value for the prop
415
417
indent_num: int
416
418
Number of indents to use for the context block
417
419
(creates 2 spaces for every indent)
@@ -429,6 +431,11 @@ def create_prop_docstring(prop_name, type_object, required, description,
429
431
indent_num = indent_num + 1 )
430
432
indent_spacing = ' ' * indent_num
431
433
434
+ if default is None :
435
+ default = ''
436
+ else :
437
+ default = default ['value' ]
438
+
432
439
is_required = 'optional'
433
440
if required :
434
441
is_required = 'required'
@@ -473,9 +480,7 @@ def shape_or_exact():
473
480
type_object = prop ,
474
481
required = prop ['required' ],
475
482
description = prop .get ('description' , '' ),
476
- default = prop .get (
477
- 'defaultValue' , {'value' : '' }
478
- )['value' ],
483
+ default = prop .get ('defaultValue' ),
479
484
indent_num = 1
480
485
) for prop_name , prop in
481
486
list (type_object ['value' ].items ())))
@@ -571,9 +576,7 @@ def map_js_to_py_types_flow_types(type_object):
571
576
type_object = prop ['value' ],
572
577
required = prop ['value' ]['required' ],
573
578
description = prop ['value' ].get ('description' , '' ),
574
- default = prop .get (
575
- 'defaultValue' , {'value' : '' }
576
- )['value' ],
579
+ default = prop .get ('defaultValue' ),
577
580
indent_num = indent_num ,
578
581
is_flow_type = True )
579
582
for prop in type_object ['signature' ]['properties' ]))),
0 commit comments