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

Input component updates #356

Merged
merged 13 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.37.0] - 2018-11-04
### Fixed
- Some Input props weren't being picked up by React. Changed:
- `autocomplete` to `autoComplete`
- `autofocus` to `autoFocus`
- `inputmode` to `inputMode`
- `maxlength` to `maxLength`
- `minlength` to `minLength`
### Added
- Unit tests for `Input` component.
- New `debounce` prop for `Input` component that determines if the input should update to a Dash server immediately, or on 'Enter' key. Fixes [#169](https://github.com/plotly/dash-core-components/issues/169)
### Changed
- `min` and `max` prop now won't update the input when values are lower than or greater than `min` and `max` respectively. Fixes[#173](https://github.com/plotly/dash-core-components/issues/173)
- `step` prop can now be a `number` and is therefor set correctly on the corresponding `<input/>` tag. Fixes [#292](https://github.com/plotly/dash-core-components/issues/292)

## [0.36.0] - 2018-11-01
### Fixed
### Fixe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The d is gone!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the d gone?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unno!

- The `npm start` command now runs the Demo app again [#346](https://github.com/plotly/dash-core-components/issues/346)

## [0.36.0] - 2018-10-31
Expand Down
20 changes: 11 additions & 9 deletions dash_core_components/Input.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class Input(Component):
- id (string; optional): The ID of this component, used to identify dash components
in callbacks. The ID needs to be unique across all of the
components in an app.
- value (string; optional): The value of the input
- value (string | number; optional): The value of the input
- style (dict; optional): The input's inline styles
- className (string; optional): The class of the input element
- 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.
Expand All @@ -29,11 +31,11 @@ class Input(Component):
input element.
This attribute is ignored when the type attribute's value is
hidden, checkbox, radio, file, or a button type.
- max (string; optional): The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
- 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.
- min (string; optional): The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
- 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.
- multiple (string; 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.
- 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.
Expand All @@ -43,22 +45,22 @@ class Input(Component):
- 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.
- step (string; 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.
- 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.
- 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.
- n_blur (number; optional): Number of times the input lost focus.
- n_blur_timestamp (number; optional): Last time the input lost focus.

Available events: 'blur', 'change'"""
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, value=Component.UNDEFINED, style=Component.UNDEFINED, className=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, **kwargs):
self._prop_names = ['id', 'value', 'style', 'className', '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']
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, **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']
self._type = 'Input'
self._namespace = 'dash_core_components'
self._valid_wildcard_attributes = []
self.available_events = ['blur', 'change']
self.available_properties = ['id', 'value', 'style', 'className', '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']
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']
self.available_wildcard_properties = []

_explicit_args = kwargs.pop('_explicit_args')
Expand Down
2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.min.js

Large diffs are not rendered by default.

55 changes: 49 additions & 6 deletions dash_core_components/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,15 @@
},
"value": {
"type": {
"name": "string"
"name": "union",
"value": [
{
"name": "string"
},
{
"name": "number"
}
]
},
"required": false,
"description": "The value of the input"
Expand All @@ -1540,6 +1548,17 @@
"required": false,
"description": "The class of the input element"
},
"debounce": {
"type": {
"name": "bool"
},
"required": false,
"description": "If true, changes to input will be sent back to the Dash server only on enter or when losing focus.\nIf it's false, it will sent the value back on every change.",
"defaultValue": {
"value": "false",
"computed": false
}
},
"type": {
"type": {
"name": "enum",
Expand Down Expand Up @@ -1668,7 +1687,15 @@
},
"max": {
"type": {
"name": "string"
"name": "union",
"value": [
{
"name": "string"
},
{
"name": "number"
}
]
},
"required": false,
"description": "The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value."
Expand All @@ -1682,7 +1709,15 @@
},
"min": {
"type": {
"name": "string"
"name": "union",
"value": [
{
"name": "string"
},
{
"name": "number"
}
]
},
"required": false,
"description": "The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value."
Expand All @@ -1696,7 +1731,7 @@
},
"multiple": {
"type": {
"name": "string"
"name": "bool"
},
"required": false,
"description": "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."
Expand Down Expand Up @@ -1764,7 +1799,7 @@
"required": false,
"description": "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": {
"spellCheck": {
"type": {
"name": "string"
},
Expand All @@ -1773,7 +1808,15 @@
},
"step": {
"type": {
"name": "string"
"name": "union",
"value": [
{
"name": "string"
},
{
"name": "number"
}
]
},
"required": false,
"description": "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."
Expand Down
5 changes: 2 additions & 3 deletions dash_core_components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-core-components",
"version": "0.36.1",
"version": "0.37.0",
"description": "Core component suite for Dash",
"repository": {
"type": "git",
Expand All @@ -21,8 +21,7 @@
"build:js": "webpack --mode production",
"build:js-dev": "webpack --mode development",
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && cp package.json dash_core_components && npm run generate-python-classes",
"build:all": "npm run build:js && npm run build:py",
"build:all-dev": "npm run build:js-dev && npm run build:py",
"build:all": "npm run build:js && npm run build:js-dev && npm run build:py",
"build:watch": "watch 'npm run build:all' src"
},
"author": "Chris Parmer <chris@plot.ly>",
Expand Down
2 changes: 1 addition & 1 deletion dash_core_components/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.36.1'
__version__ = '0.37.0'
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-core-components",
"version": "0.36.1",
"version": "0.37.0",
"description": "Core component suite for Dash",
"repository": {
"type": "git",
Expand All @@ -21,8 +21,7 @@
"build:js": "webpack --mode production",
"build:js-dev": "webpack --mode development",
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && cp package.json dash_core_components && npm run generate-python-classes",
"build:all": "npm run build:js && npm run build:py",
"build:all-dev": "npm run build:js-dev && npm run build:py",
"build:all": "npm run build:js && npm run build:js-dev && npm run build:py",
"build:watch": "watch 'npm run build:all' src"
},
"author": "Chris Parmer <chris@plot.ly>",
Expand Down
Loading