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

Fix prop types #523

Merged
merged 49 commits into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f2e648e
label & value are required in options
chriddyp Apr 12, 2019
6f6d4f4
extend data is an array i think?
chriddyp Apr 12, 2019
c1aae29
simple figure validation
chriddyp Apr 12, 2019
d7687ac
html property handling
chriddyp Apr 12, 2019
e49da69
marks prop type was wrong
chriddyp Apr 12, 2019
f7265c7
objectOf to the rescue
chriddyp Apr 13, 2019
59031e7
fix properties that weren't camelCase & update boolean props
chriddyp Apr 13, 2019
e9cb3d8
slightly more specific figure definition
chriddyp Apr 13, 2019
5bfa025
:pencil: changelog
chriddyp Apr 13, 2019
bd6d771
date number not date object
chriddyp Apr 13, 2019
50ca713
:pencil: include note about n_blur_timestamp fix
chriddyp Apr 13, 2019
3dd9647
Date.now() fix
chriddyp Apr 15, 2019
e981a1c
html boolean properties
chriddyp Apr 15, 2019
0aeec4b
html enum properties
chriddyp Apr 15, 2019
4f97871
strings or numbers
chriddyp Apr 15, 2019
2899d02
prettier
chriddyp Apr 15, 2019
c5a96a3
update changelog
chriddyp Apr 15, 2019
f85c741
test with dev-tools
chriddyp Apr 15, 2019
296a50b
use `exact` instead of `shape`
chriddyp Apr 15, 2019
ac12cb7
prevent ConfirmDialog from firing multiple alerts at once
chriddyp Apr 17, 2019
5f109d9
include `exact` fixes in tests
chriddyp Apr 17, 2019
99182b2
`chriddyp-dev-tools` was merged into `dev-tools`
chriddyp Apr 17, 2019
ee8781b
prettier
chriddyp Apr 17, 2019
9789d71
.exact isn't supported until v3.0.0
chriddyp Apr 17, 2019
d3e4a68
package-lock update
chriddyp Apr 17, 2019
f64012e
update changelog to include ConfirmDialog fix
chriddyp Apr 17, 2019
bb89993
try running the tests with devtools turned on
chriddyp Apr 17, 2019
6104d5d
allow numbers & strings
chriddyp Apr 18, 2019
ca52b21
:wrench: change back to master
Apr 18, 2019
7191fe4
:lipstick: prettier
Apr 18, 2019
599daeb
`extendData` takes an array or an object
chriddyp Apr 18, 2019
98c8794
hide dev_tools_ui for tests so that screenshots are the same
chriddyp Apr 18, 2019
41a3f31
prettier
chriddyp Apr 18, 2019
96fc7b6
support datepickersingle as an uncontrolled component
chriddyp Apr 18, 2019
0f04a50
similar fix for DatePickerRange
chriddyp Apr 18, 2019
2ffefb6
include link to dash-renderer issue
chriddyp Apr 18, 2019
92799ac
just include ids in props for now
chriddyp Apr 18, 2019
55d15dd
:hocho:
chriddyp Apr 18, 2019
b526f98
rm state checks for dates
chriddyp Apr 18, 2019
fc6c6d7
prettier
chriddyp Apr 19, 2019
93e2f01
:bow: thanks @byronz
chriddyp Apr 19, 2019
2081efb
:bug: fixing the onDataChange logic
Apr 19, 2019
a116ec4
:lipstick: prettier
Apr 19, 2019
18f0a17
:white_check_mark: fix test
Apr 19, 2019
b5a06fe
:hocho: :bug: fix the bug and improve the test
Apr 19, 2019
c416812
:package: bundles
Apr 19, 2019
ca47915
:white_check_mark: every month has at least 28
Apr 19, 2019
8e1475a
:lipstick: prettier
Apr 19, 2019
d7851a1
:lipstick: flake8
Apr 19, 2019
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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Fixed
- Fix style regression in DatePickerSingle and DatePickerRange [#518](https://github.com/plotly/dash-core-components/issues/518)
- Fixed style regression in DatePickerSingle and DatePickerRange [#518](https://github.com/plotly/dash-core-components/issues/518)
- **Breaking** - In `dcc.Input`, fixed several HTML properties that weren't properly camel cased and therefore were not actually applied in the DOM [#523](https://github.com/plotly/dash-core-components/pull/523/):
- `autocomplete` is now `autoComplete`
- `autofocus` is now `autoFocus`
- `inputmode` is now `inputMode`
- `maxlength` is now `maxLength`
- `minlength` is now `minLength`
- Improved property definitions of various components in anticipation of upcoming component validation (https://github.com/plotly/dash-renderer/pull/100/). [#523](https://github.com/plotly/dash-core-components/pull/523/)
- **Breaking** - `n_blur_timestamp` & `n_submit_timestamp` in `Input` & `Textarea` is now a number instead of a date object/string. This matches the form of `n_clicks_timestamp` as used in `dash_html_components`. [#523](https://github.com/plotly/dash-core-components/pull/523/)
- Fixed an issue with `ConfirmDialog` that could display multiple confirm popups instead of a single popup in certain contexts. [#523](https://github.com/plotly/dash-core-components/pull/523/)


## [0.46.0] - 2019-04-10
### Added
Expand Down
2 changes: 1 addition & 1 deletion dash_core_components/Dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Dropdown(Component):
Keyword arguments:
- id (string; optional)
- options (list; optional): An array of options
- value (string | list; optional): The value of the input. If `multi` is false (the default)
- value (string | list | number | list; optional): The value of the input. If `multi` is false (the default)
then value is just a string that corresponds to the values
provided in the `options` property. If `multi` is true, then
multiple values can be selected at once, and `value` is an
Expand Down
9 changes: 6 additions & 3 deletions dash_core_components/Graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Graph(Component):
when the user zooms or pans on the plot or other
layout-level edits. Has the form `{<attr string>: <value>}`
describing the changes made. Read-only.
- extendData (dict; optional): Data that should be appended to existing traces. Has the form
- extendData (list | dict; optional): Data that should be appended to existing traces. Has the form
`[updateData, traceIndices, maxPoints]`, where `updateData` is an object
containing the data to extend, `traceIndices` (optional) is an array of
trace indices that should be extended, and `maxPoints` (optional) is
Expand All @@ -38,11 +38,14 @@ class Graph(Component):
`{<attr string>: <value>}` describing the changes made,
and `indices` is an array of trace indices that were edited.
Read-only.
- figure (dict; optional): Plotly `figure` object. See schema:
- figure (optional): Plotly `figure` object. See schema:
https://plot.ly/javascript/reference
Only supports `data` array and `layout` object.
`config` is set separately by the `config` property,
and `frames` is not supported.
and `frames` is not supported.. figure has the following type: dict containing keys 'data', 'layout'.
Those keys have the following types:
- data (list; optional)
- layout (dict; optional)
- style (dict; optional): Generic style overrides on the plot div
- className (string; optional): className of the parent div
- animate (boolean; optional): Beta: If true, animate between updates using
Expand Down
37 changes: 24 additions & 13 deletions dash_core_components/Input.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,42 @@ class Input(Component):
- debounce (boolean; optional): If true, changes to input will be sent back to the Dash server only on enter or when losing focus.
If it's false, it will sent the value back on every change.
- type (a value equal to: "text", 'number', 'password', 'email', 'range', 'search', 'tel', 'url', 'hidden'; optional): The type of control to render.
- autocomplete (string; optional): This attribute indicates whether the value of the control can be automatically completed by the browser.
- autofocus (string; optional): The element should be automatically focused after the page loaded.
- disabled (boolean; optional): If true, the input is disabled and can't be clicked on.
- inputmode (a value equal to: "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "katakana", "numeric", "tel", "email", "url"; optional)
- autoComplete (string; optional): This attribute indicates whether the value of the control can be automatically completed by the browser.
- autoFocus (a value equal to: 'autoFocus', 'autofocus', 'AUTOFOCUS' | boolean; optional): The element should be automatically focused after the page loaded.
autoFocus is an HTML boolean attribute - it is enabled by a boolean or
'autoFocus'. Alternative capitalizations `autofocus` & `AUTOFOCUS`
are also acccepted.
- disabled (a value equal to: 'disabled', 'DISABLED' | boolean; optional): If true, the input is disabled and can't be clicked on.
disabled is an HTML boolean attribute - it is enabled by a boolean or
'disabled'. Alternative capitalizations `DISABLED`
- inputMode (a value equal to: "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "katakana", "numeric", "tel", "email", "url"; optional)
- list (string; optional): Identifies a list of pre-defined options to suggest to the user.
The value must be the id of a <datalist> element in the same document.
The browser displays only options that are valid values for this
input element.
This attribute is ignored when the type attribute's value is
hidden, checkbox, radio, file, or a button type.
- max (string | number; optional): The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
- maxlength (string; optional): If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters (in UTF-16 code units) that the user can enter. For other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior (i.e. the user can enter an unlimited number of characters). The constraint is evaluated only when the value of the attribute has been changed.
- maxLength (string | number; optional): If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters (in UTF-16 code units) that the user can enter. For other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior (i.e. the user can enter an unlimited number of characters). The constraint is evaluated only when the value of the attribute has been changed.
- min (string | number; optional): The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
- minlength (string; optional): If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter. For other control types, it is ignored.
- minLength (string | number; optional): If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter. For other control types, it is ignored.
- multiple (boolean; optional): This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file, otherwise it is ignored.
- name (string; optional): The name of the control, which is submitted with the form data.
- pattern (string; optional): A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url, email, or password, otherwise it is ignored. The regular expression language is the same as JavaScript RegExp algorithm, with the 'u' parameter that makes it treat the pattern as a sequence of unicode code points. The pattern is not surrounded by forward slashes.
- placeholder (string; optional): A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. Note: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.
- readOnly (string; optional): This attribute indicates that the user cannot modify the value of the control. The value of the attribute is irrelevant. If you need read-write access to the input value, do not add the "readonly" attribute. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type (such as button or submit).
- required (string; optional): This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
- placeholder (string | number; optional): A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. Note: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.
- readOnly (boolean | a value equal to: 'readOnly', 'readonly', 'READONLY'; optional): This attribute indicates that the user cannot modify the value of the control. The value of the attribute is irrelevant. If you need read-write access to the input value, do not add the "readonly" attribute. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type (such as button or submit).
readOnly is an HTML boolean attribute - it is enabled by a boolean or
'readOnly'. Alternative capitalizations `readonly` & `READONLY`
are also acccepted.
- required (a value equal to: 'required', 'REQUIRED' | boolean; optional): This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
required is an HTML boolean attribute - it is enabled by a boolean or
'required'. Alternative capitalizations `REQUIRED`
are also acccepted.
- selectionDirection (string; optional): The direction in which selection occurred. This is "forward" if the selection was made from left-to-right in an LTR locale or right-to-left in an RTL locale, or "backward" if the selection was made in the opposite direction. On platforms on which it's possible this value isn't known, the value can be "none"; for example, on macOS, the default direction is "none", then as the user begins to modify the selection using the keyboard, this will change to reflect the direction in which the selection is expanding.
- selectionEnd (string; optional): The offset into the element's text content of the last selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
- selectionStart (string; optional): The offset into the element's text content of the first selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
- size (string; optional): The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case it is an integer number of characters. Starting in, this attribute applies only when the type attribute is set to text, search, tel, url, email, or password, otherwise it is ignored. In addition, the size must be greater than zero. If you do not specify a size, a default value of 20 is used.' simply states "the user agent should ensure that at least that many characters are visible", but different characters can have different widths in certain fonts. In some browsers, a certain string with x characters will not be entirely visible even if size is defined to at least x.
- spellCheck (string; optional): Setting the value of this attribute to true indicates that the element needs to have its spelling and grammar checked. The value default indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. The value false indicates that the element should not be checked.
- spellCheck (a value equal to: 'true', 'false' | boolean; optional): Setting the value of this attribute to true indicates that the element needs to have its spelling and grammar checked. The value default indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. The value false indicates that the element should not be checked.
- step (string | number; optional): Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
- n_submit (number; optional): Number of times the `Enter` key was pressed while the input had focus.
- n_submit_timestamp (number; optional): Last time that `Enter` was pressed.
Expand All @@ -57,12 +68,12 @@ class Input(Component):
- prop_name (string; optional): Holds which property is loading
- component_name (string; optional): Holds the name of the component that is loading"""
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, value=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, debounce=Component.UNDEFINED, type=Component.UNDEFINED, autocomplete=Component.UNDEFINED, autofocus=Component.UNDEFINED, disabled=Component.UNDEFINED, inputmode=Component.UNDEFINED, list=Component.UNDEFINED, max=Component.UNDEFINED, maxlength=Component.UNDEFINED, min=Component.UNDEFINED, minlength=Component.UNDEFINED, multiple=Component.UNDEFINED, name=Component.UNDEFINED, pattern=Component.UNDEFINED, placeholder=Component.UNDEFINED, readOnly=Component.UNDEFINED, required=Component.UNDEFINED, selectionDirection=Component.UNDEFINED, selectionEnd=Component.UNDEFINED, selectionStart=Component.UNDEFINED, size=Component.UNDEFINED, spellCheck=Component.UNDEFINED, step=Component.UNDEFINED, n_submit=Component.UNDEFINED, n_submit_timestamp=Component.UNDEFINED, n_blur=Component.UNDEFINED, n_blur_timestamp=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'value', 'style', 'className', 'debounce', 'type', 'autocomplete', 'autofocus', 'disabled', 'inputmode', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'selectionDirection', 'selectionEnd', 'selectionStart', 'size', 'spellCheck', 'step', 'n_submit', 'n_submit_timestamp', 'n_blur', 'n_blur_timestamp', 'loading_state']
def __init__(self, id=Component.UNDEFINED, value=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, debounce=Component.UNDEFINED, type=Component.UNDEFINED, autoComplete=Component.UNDEFINED, autoFocus=Component.UNDEFINED, disabled=Component.UNDEFINED, inputMode=Component.UNDEFINED, list=Component.UNDEFINED, max=Component.UNDEFINED, maxLength=Component.UNDEFINED, min=Component.UNDEFINED, minLength=Component.UNDEFINED, multiple=Component.UNDEFINED, name=Component.UNDEFINED, pattern=Component.UNDEFINED, placeholder=Component.UNDEFINED, readOnly=Component.UNDEFINED, required=Component.UNDEFINED, selectionDirection=Component.UNDEFINED, selectionEnd=Component.UNDEFINED, selectionStart=Component.UNDEFINED, size=Component.UNDEFINED, spellCheck=Component.UNDEFINED, step=Component.UNDEFINED, n_submit=Component.UNDEFINED, n_submit_timestamp=Component.UNDEFINED, n_blur=Component.UNDEFINED, n_blur_timestamp=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'value', 'style', 'className', 'debounce', 'type', 'autoComplete', 'autoFocus', 'disabled', 'inputMode', 'list', 'max', 'maxLength', 'min', 'minLength', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'selectionDirection', 'selectionEnd', 'selectionStart', 'size', 'spellCheck', 'step', 'n_submit', 'n_submit_timestamp', 'n_blur', 'n_blur_timestamp', 'loading_state']
self._type = 'Input'
self._namespace = 'dash_core_components'
self._valid_wildcard_attributes = []
self.available_properties = ['id', 'value', 'style', 'className', 'debounce', 'type', 'autocomplete', 'autofocus', 'disabled', 'inputmode', 'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'selectionDirection', 'selectionEnd', 'selectionStart', 'size', 'spellCheck', 'step', 'n_submit', 'n_submit_timestamp', 'n_blur', 'n_blur_timestamp', 'loading_state']
self.available_properties = ['id', 'value', 'style', 'className', 'debounce', 'type', 'autoComplete', 'autoFocus', 'disabled', 'inputMode', 'list', 'max', 'maxLength', 'min', 'minLength', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'selectionDirection', 'selectionEnd', 'selectionStart', 'size', 'spellCheck', 'step', 'n_submit', 'n_submit_timestamp', 'n_blur', 'n_blur_timestamp', 'loading_state']
self.available_wildcard_properties = []

_explicit_args = kwargs.pop('_explicit_args')
Expand Down
8 changes: 3 additions & 5 deletions dash_core_components/RangeSlider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ class RangeSlider(Component):
Keyword arguments:
- id (string; optional)
- marks (optional): Marks on the slider.
The key determines the position,
The key determines the position (a number),
and the value determines what will show.
If you want to set the style of a specific mark point,
the value should be an object which
contains style and label properties.. marks has the following type: dict containing keys 'number'.
contains style and label properties.. marks has the following type: dict with strings as keys and values of type string | dict containing keys 'label', 'style'.
Those keys have the following types:
- number (optional): . number has the following type: string | dict containing keys 'style', 'label'.
Those keys have the following types:
- style (dict; optional)
- label (string; optional)
- style (dict; optional)
- value (list; optional): The value of the input
- allowCross (boolean; optional): allowCross could be set as true to allow those handles to cross.
- className (string; optional): Additional CSS class for the root DOM node
Expand Down
Loading