Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Components with schema #289

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5b42afd
Components with schema
rmarren1 Aug 30, 2018
8fbf0cf
Update component schemas.
rmarren1 Sep 3, 2018
9ba5842
Validation framework on only terminal types.
rmarren1 Sep 6, 2018
50623cd
Lock down component PropTypes, fix some rogue tests
rmarren1 Sep 7, 2018
9fea394
Bump dash version to release candidate for testing.
rmarren1 Sep 7, 2018
2a67fd2
Merge branch 'master' into validation
rmarren1 Sep 7, 2018
298eafc
Cerberus requirement
rmarren1 Sep 7, 2018
9b47ef0
Re-build and bump version.
rmarren1 Sep 7, 2018
cb8375c
Validation framework for non-terminal types.
rmarren1 Sep 11, 2018
d2e7d18
Test that each working component can initialize in an app.
rmarren1 Sep 13, 2018
89a864e
Test that each working component can have props set via callback.
rmarren1 Sep 14, 2018
8617d16
Prevent front-end errors during test suite run.
rmarren1 Sep 20, 2018
79cd678
Fix integration tests.
rmarren1 Sep 20, 2018
9bab922
Bump dash requirement in dev.
rmarren1 Sep 20, 2018
bc2319c
Remove test link scroll.
rmarren1 Sep 20, 2018
5b80c6f
bump dash-html-components version
rmarren1 Sep 21, 2018
bbe0fb0
Merge branch 'master' into validation
rmarren1 Sep 21, 2018
af3c508
Remove test tabs with children undefined
rmarren1 Sep 21, 2018
713aebb
Delete example.py -- accidentally added.
rmarren1 Sep 21, 2018
52ffd43
Add 'RangeSlider' to untested components.
rmarren1 Sep 26, 2018
205a60d
Add tests for PropTypes.shape
rmarren1 Sep 26, 2018
46cac23
Add 'integer' terminal type.
rmarren1 Sep 26, 2018
df699dd
Improve testcase workflow
rmarren1 Sep 26, 2018
2106a19
Fix RangeSlider 'marks' PropTypes.
rmarren1 Sep 26, 2018
e1797a6
Re-build Python classes :snake:
rmarren1 Sep 26, 2018
dc1ab36
Merge branch 'master' into validation
rmarren1 Sep 26, 2018
6194e1d
Update Graph displayModeBar PropType
rmarren1 Sep 29, 2018
fcb8aa0
Regenerate components with new dash
rmarren1 Sep 29, 2018
cf8e9e9
Bump dash version, change testing to accomodate.
rmarren1 Oct 2, 2018
a815301
Change Input PropTypes to include `number` where it needs to be.
rmarren1 Oct 19, 2018
23e3f8b
rebase
rmarren1 Oct 19, 2018
43c89c9
rebase
rmarren1 Oct 19, 2018
5cbbee0
Run prettier
rmarren1 Oct 19, 2018
e7a6152
Bump dash version in requirements.
rmarren1 Oct 19, 2018
03a919e
Re-build all components
rmarren1 Oct 19, 2018
b58e1c6
Rabase and add component validation to CI.
rmarren1 Oct 19, 2018
bf3f58e
Run prettier
rmarren1 Oct 19, 2018
5d1f5a0
Reset test_integration to current branch.
rmarren1 Oct 19, 2018
2b7414d
Bump to dash==0.31.0rc1 and re-:package:
rmarren1 Nov 24, 2018
19b8369
Rebase and re-:package:
rmarren1 Nov 24, 2018
beebfef
Lock dev-requirements `dash` version to validation RC.
rmarren1 Nov 24, 2018
c14e357
Bump dash-renderer requirement for ci.
rmarren1 Nov 24, 2018
65a422e
Build components.
rmarren1 Dec 18, 2018
215f6aa
Fix flake8 errors.
rmarren1 Dec 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions dash_core_components/Checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'options': {'type': 'list', 'schema': {'type': 'dict', 'allow_unknown': False, 'nullable': False, 'schema': {'label': {'type': 'string'}, 'value': {'type': 'string'}, 'disabled': {'type': 'boolean'}}}}, 'values': {'type': 'list', 'schema': {'type': 'string', 'nullable': False}, 'required': True}, 'className': {'type': 'string'}, 'style': {'type': 'dict'}, 'inputStyle': {'type': 'dict'}, 'inputClassName': {'type': 'string'}, 'labelStyle': {'type': 'dict'}, 'labelClassName': {'type': 'string'}, 'fireEvent': {}, 'setProps': {}, 'dashEvents': {'allowed': ['change'], 'type': ('string', 'number')}}

class Checklist(Component):
"""A Checklist component.
Checklist is a component that encapsulates several checkboxes.
Expand All @@ -13,7 +16,7 @@ class Checklist(Component):
Keyword arguments:
- id (string; optional)
- options (list; optional): An array of options
- values (list; optional): The currently selected value
- values (list; required): The currently selected value
- className (string; optional): The class of the container (div)
- style (dict; optional): The style of the container (div)
- inputStyle (dict; optional): The style of the <input> checkbox element
Expand All @@ -24,8 +27,9 @@ class Checklist(Component):
and the option's label

Available events: 'change'"""
_schema = schema
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, values=Component.UNDEFINED, className=Component.UNDEFINED, style=Component.UNDEFINED, inputStyle=Component.UNDEFINED, inputClassName=Component.UNDEFINED, labelStyle=Component.UNDEFINED, labelClassName=Component.UNDEFINED, **kwargs):
def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, values=Component.REQUIRED, className=Component.UNDEFINED, style=Component.UNDEFINED, inputStyle=Component.UNDEFINED, inputClassName=Component.UNDEFINED, labelStyle=Component.UNDEFINED, labelClassName=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'options', 'values', 'className', 'style', 'inputStyle', 'inputClassName', 'labelStyle', 'labelClassName']
self._type = 'Checklist'
self._namespace = 'dash_core_components'
Expand All @@ -37,12 +41,13 @@ def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, values=C
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
for k in ['values']:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(Checklist, self).__init__(**args)

def __repr__(self):
Expand Down
9 changes: 7 additions & 2 deletions dash_core_components/ConfirmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'message': {'type': 'string'}, 'submit_n_clicks': {'type': 'number'}, 'submit_n_clicks_timestamp': {'type': 'number'}, 'cancel_n_clicks': {'type': 'number'}, 'cancel_n_clicks_timestamp': {'type': 'number'}, 'displayed': {'anyof': [{'allowed': [None], 'type': ('string', 'number'), 'nullable': True}, {'type': 'boolean'}], 'nullable': True}, 'key': {'type': 'string'}, 'setProps': {}}

class ConfirmDialog(Component):
"""A ConfirmDialog component.
ConfirmDialog is used to display the browser's native "confirm" modal,
Expand All @@ -17,10 +20,11 @@ class ConfirmDialog(Component):
- submit_n_clicks_timestamp (number; optional): Last time the submit button was clicked.
- cancel_n_clicks (number; optional): Number of times the popup was canceled.
- cancel_n_clicks_timestamp (number; optional): Last time the cancel button was clicked.
- displayed (boolean; optional): Set to true to send the ConfirmDialog.
- displayed (a value equal to: null | boolean; optional): Set to true to send the ConfirmDialog.
- key (string; optional)

Available events: """
_schema = schema
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, message=Component.UNDEFINED, submit_n_clicks=Component.UNDEFINED, submit_n_clicks_timestamp=Component.UNDEFINED, cancel_n_clicks=Component.UNDEFINED, cancel_n_clicks_timestamp=Component.UNDEFINED, displayed=Component.UNDEFINED, key=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'message', 'submit_n_clicks', 'submit_n_clicks_timestamp', 'cancel_n_clicks', 'cancel_n_clicks_timestamp', 'displayed', 'key']
Expand All @@ -34,12 +38,13 @@ def __init__(self, id=Component.UNDEFINED, message=Component.UNDEFINED, submit_n
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(ConfirmDialog, self).__init__(**args)

def __repr__(self):
Expand Down
9 changes: 7 additions & 2 deletions dash_core_components/ConfirmDialogProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'message': {'type': 'string'}, 'submit_n_clicks': {'type': 'number'}, 'submit_n_clicks_timestamp': {'type': 'number'}, 'cancel_n_clicks': {'type': 'number'}, 'cancel_n_clicks_timestamp': {'type': 'number'}, 'displayed': {'type': 'boolean'}, 'setProps': {}, 'children': {'anyof': [{'type': 'string'}, {'type': 'number'}, {'type': 'boolean'}, {'type': 'component'}, {'allowed': [None], 'type': ('string', 'number'), 'nullable': True}, {'type': 'list', 'schema': {'anyof': [{'type': 'string'}, {'type': 'number'}, {'type': 'boolean'}, {'type': 'component'}, {'allowed': [None], 'type': ('string', 'number'), 'nullable': True}], 'nullable': True}}], 'nullable': True}}

class ConfirmDialogProvider(Component):
"""A ConfirmDialogProvider component.
A wrapper component that will display a confirmation dialog
Expand All @@ -17,7 +20,7 @@ class ConfirmDialogProvider(Component):
```

Keyword arguments:
- children (boolean | number | string | dict | list; optional): The children to hijack clicks from and display the popup.
- children (string | number | boolean | dash component | a value equal to: null | list; optional): The children to hijack clicks from and display the popup.
- id (string; optional)
- message (string; optional): Message to show in the popup.
- submit_n_clicks (number; optional): Number of times the submit was clicked
Expand All @@ -27,6 +30,7 @@ class ConfirmDialogProvider(Component):
- displayed (boolean; optional): Is the modal currently displayed.

Available events: """
_schema = schema
@_explicitize_args
def __init__(self, children=None, id=Component.UNDEFINED, message=Component.UNDEFINED, submit_n_clicks=Component.UNDEFINED, submit_n_clicks_timestamp=Component.UNDEFINED, cancel_n_clicks=Component.UNDEFINED, cancel_n_clicks_timestamp=Component.UNDEFINED, displayed=Component.UNDEFINED, **kwargs):
self._prop_names = ['children', 'id', 'message', 'submit_n_clicks', 'submit_n_clicks_timestamp', 'cancel_n_clicks', 'cancel_n_clicks_timestamp', 'displayed']
Expand All @@ -40,12 +44,13 @@ def __init__(self, children=None, id=Component.UNDEFINED, message=Component.UNDE
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(ConfirmDialogProvider, self).__init__(children=children, **args)

def __repr__(self):
Expand Down
7 changes: 6 additions & 1 deletion dash_core_components/DatePickerRange.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'start_date': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'end_date': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'min_date_allowed': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'max_date_allowed': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'initial_visible_month': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'start_date_placeholder_text': {'type': 'string'}, 'end_date_placeholder_text': {'type': 'string'}, 'day_size': {'type': 'number'}, 'calendar_orientation': {'allowed': ['vertical', 'horizontal'], 'type': ('string', 'number')}, 'is_RTL': {'type': 'boolean'}, 'reopen_calendar_on_clear': {'type': 'boolean'}, 'number_of_months_shown': {'type': 'number'}, 'with_portal': {'type': 'boolean'}, 'with_full_screen_portal': {'type': 'boolean'}, 'first_day_of_week': {'allowed': ['0', '1', '2', '3', '4', '5', '6'], 'type': ('string', 'number')}, 'minimum_nights': {'type': 'number'}, 'stay_open_on_select': {'type': 'boolean'}, 'show_outside_days': {'type': 'boolean'}, 'month_format': {'type': 'string'}, 'display_format': {'type': 'string'}, 'disabled': {'type': 'boolean'}, 'clearable': {'type': 'boolean'}, 'setProps': {}, 'dashEvents': {'allowed': ['change'], 'type': ('string', 'number')}, 'updatemode': {'allowed': ['singledate', 'bothdates'], 'type': ('string', 'number')}, 'fireEvent': {}}

class DatePickerRange(Component):
"""A DatePickerRange component.
DatePickerRange is a tailor made component designed for selecting
Expand Down Expand Up @@ -80,6 +83,7 @@ class DatePickerRange(Component):
as one date is picked.

Available events: 'change'"""
_schema = schema
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, start_date=Component.UNDEFINED, end_date=Component.UNDEFINED, min_date_allowed=Component.UNDEFINED, max_date_allowed=Component.UNDEFINED, initial_visible_month=Component.UNDEFINED, start_date_placeholder_text=Component.UNDEFINED, end_date_placeholder_text=Component.UNDEFINED, day_size=Component.UNDEFINED, calendar_orientation=Component.UNDEFINED, is_RTL=Component.UNDEFINED, reopen_calendar_on_clear=Component.UNDEFINED, number_of_months_shown=Component.UNDEFINED, with_portal=Component.UNDEFINED, with_full_screen_portal=Component.UNDEFINED, first_day_of_week=Component.UNDEFINED, minimum_nights=Component.UNDEFINED, stay_open_on_select=Component.UNDEFINED, show_outside_days=Component.UNDEFINED, month_format=Component.UNDEFINED, display_format=Component.UNDEFINED, disabled=Component.UNDEFINED, clearable=Component.UNDEFINED, updatemode=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'start_date', 'end_date', 'min_date_allowed', 'max_date_allowed', 'initial_visible_month', 'start_date_placeholder_text', 'end_date_placeholder_text', 'day_size', 'calendar_orientation', 'is_RTL', 'reopen_calendar_on_clear', 'number_of_months_shown', 'with_portal', 'with_full_screen_portal', 'first_day_of_week', 'minimum_nights', 'stay_open_on_select', 'show_outside_days', 'month_format', 'display_format', 'disabled', 'clearable', 'updatemode']
Expand All @@ -93,12 +97,13 @@ def __init__(self, id=Component.UNDEFINED, start_date=Component.UNDEFINED, end_d
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(DatePickerRange, self).__init__(**args)

def __repr__(self):
Expand Down
7 changes: 6 additions & 1 deletion dash_core_components/DatePickerSingle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'date': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'min_date_allowed': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'max_date_allowed': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'initial_visible_month': {'anyof': [{'type': 'string'}, {'type': 'datetime'}]}, 'day_size': {'type': 'number'}, 'calendar_orientation': {'allowed': ['vertical', 'horizontal'], 'type': ('string', 'number')}, 'is_RTL': {'type': 'boolean'}, 'placeholder': {'type': 'string'}, 'reopen_calendar_on_clear': {'type': 'boolean'}, 'number_of_months_shown': {'type': 'number'}, 'with_portal': {'type': 'boolean'}, 'with_full_screen_portal': {'type': 'boolean'}, 'first_day_of_week': {'allowed': ['0', '1', '2', '3', '4', '5', '6'], 'type': ('string', 'number')}, 'stay_open_on_select': {'type': 'boolean'}, 'show_outside_days': {'type': 'boolean'}, 'month_format': {'type': 'string'}, 'display_format': {'type': 'string'}, 'disabled': {'type': 'boolean'}, 'clearable': {'type': 'boolean'}, 'setProps': {}, 'dashEvents': {'allowed': ['change'], 'type': ('string', 'number')}, 'fireEvent': {}}

class DatePickerSingle(Component):
"""A DatePickerSingle component.
DatePickerSingle is a tailor made component designed for selecting
Expand Down Expand Up @@ -67,6 +70,7 @@ class DatePickerSingle(Component):
the selected value.

Available events: 'change'"""
_schema = schema
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, date=Component.UNDEFINED, min_date_allowed=Component.UNDEFINED, max_date_allowed=Component.UNDEFINED, initial_visible_month=Component.UNDEFINED, day_size=Component.UNDEFINED, calendar_orientation=Component.UNDEFINED, is_RTL=Component.UNDEFINED, placeholder=Component.UNDEFINED, reopen_calendar_on_clear=Component.UNDEFINED, number_of_months_shown=Component.UNDEFINED, with_portal=Component.UNDEFINED, with_full_screen_portal=Component.UNDEFINED, first_day_of_week=Component.UNDEFINED, stay_open_on_select=Component.UNDEFINED, show_outside_days=Component.UNDEFINED, month_format=Component.UNDEFINED, display_format=Component.UNDEFINED, disabled=Component.UNDEFINED, clearable=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'date', 'min_date_allowed', 'max_date_allowed', 'initial_visible_month', 'day_size', 'calendar_orientation', 'is_RTL', 'placeholder', 'reopen_calendar_on_clear', 'number_of_months_shown', 'with_portal', 'with_full_screen_portal', 'first_day_of_week', 'stay_open_on_select', 'show_outside_days', 'month_format', 'display_format', 'disabled', 'clearable']
Expand All @@ -80,12 +84,13 @@ def __init__(self, id=Component.UNDEFINED, date=Component.UNDEFINED, min_date_al
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(DatePickerSingle, self).__init__(**args)

def __repr__(self):
Expand Down
7 changes: 6 additions & 1 deletion dash_core_components/Dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from dash.development.base_component import Component, _explicitize_args



schema = {'id': {'type': 'string'}, 'options': {'type': 'list', 'schema': {'type': 'dict', 'allow_unknown': False, 'nullable': False, 'schema': {'label': {'type': 'string'}, 'value': {'type': 'string'}, 'disabled': {'type': 'boolean'}}}}, 'value': {'anyof': [{'type': 'string'}, {'type': 'list', 'schema': {'type': 'string', 'nullable': False}}]}, 'className': {'type': 'string'}, 'clearable': {'type': 'boolean'}, 'disabled': {'type': 'boolean'}, 'multi': {'type': 'boolean'}, 'placeholder': {'type': 'string'}, 'searchable': {'type': 'boolean'}, 'setProps': {}, 'style': {'type': 'dict'}, 'dashEvents': {'allowed': ['change'], 'type': ('string', 'number')}, 'fireEvent': {}}

class Dropdown(Component):
"""A Dropdown component.
Dropdown is an interactive dropdown element for selecting one or more
Expand Down Expand Up @@ -34,6 +37,7 @@ class Dropdown(Component):
- style (dict; optional)

Available events: 'change'"""
_schema = schema
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, value=Component.UNDEFINED, className=Component.UNDEFINED, clearable=Component.UNDEFINED, disabled=Component.UNDEFINED, multi=Component.UNDEFINED, placeholder=Component.UNDEFINED, searchable=Component.UNDEFINED, style=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'options', 'value', 'className', 'clearable', 'disabled', 'multi', 'placeholder', 'searchable', 'style']
Expand All @@ -47,12 +51,13 @@ def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, value=Co
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
args = {k: _locals[k] for k in _explicit_args}

for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
args.pop('children', None)
super(Dropdown, self).__init__(**args)

def __repr__(self):
Expand Down
Loading