Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8534325
- add d3-format 3rd party library
Feb 15, 2019
a56c7d8
- update tests
Feb 15, 2019
b5727c3
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 18, 2019
c754615
- add locale logic and nested props
Feb 18, 2019
1ac8bfa
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 18, 2019
c210430
- locale support
Feb 18, 2019
aad2b80
- format validation that we can't do with our usage of proptypes
Feb 18, 2019
4f2263f
- this is js, not ts!
Feb 18, 2019
b537f24
incorrect usage
Feb 18, 2019
de4bd16
- first draft of py formatting helpers
Feb 18, 2019
37c5ac9
- merge format and specifier
Feb 19, 2019
d0a8826
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 20, 2019
a76e9cf
- table level `locale_format` prop
Feb 20, 2019
45ddda6
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 20, 2019
58ae65e
- document new props
Feb 20, 2019
64b2b75
- fix ts import resolution for tests (in IDE)
Feb 20, 2019
a287764
- unit tests of type/number formatter
Feb 21, 2019
2885238
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 21, 2019
8ecd996
- push data table validation up the stack
Feb 21, 2019
c780083
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 21, 2019
df174fb
fix lint
Feb 21, 2019
36c9155
- isolate column sanitation (clone)
Feb 21, 2019
fb0d29e
- isolate d3 idiosyncracy (thousands) from API
Feb 21, 2019
6619066
- separate thousands nested prop, tests and defaults
Feb 21, 2019
6523f9c
- update changelog
Feb 21, 2019
dc13b4e
- formatting app mode with a few variations baked in
Feb 21, 2019
fc95c5f
- fix clipboard behavior when copying nully data
Feb 21, 2019
f33280c
- fix clipboard behavior on nully cases
Feb 21, 2019
d4ad094
- update py implementation for helpers
Feb 22, 2019
b9655e9
- kwargs (a first attempt, I'm sure)
Feb 22, 2019
a2b1413
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 22, 2019
1b5b471
- remove unused imports
Feb 22, 2019
f5f840c
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 22, 2019
1fcc851
- default specifier / sanitation
Feb 22, 2019
e294ee1
make sure flake8 is present for linting job!
Feb 22, 2019
f9c599c
exec-sh?
Feb 22, 2019
88ee721
.
Feb 22, 2019
5c13118
.
Feb 22, 2019
c3c338f
.
Feb 22, 2019
164bde9
.
Feb 22, 2019
351395a
.
Feb 22, 2019
a4c4f51
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 25, 2019
07bad56
- update Format class
Feb 25, 2019
c994ef8
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 25, 2019
7f3c222
- to_plotly_json
Feb 25, 2019
121dc86
- rename currency to symbol
Feb 25, 2019
b618183
fix lint
Feb 25, 2019
1938bee
- format unit tests
Feb 25, 2019
a2d5bab
- update templates
Feb 25, 2019
4c3a91a
- sanity on templates
Feb 25, 2019
52a4d30
- improve format templates
Feb 26, 2019
3956b50
- fix format tempates
Feb 26, 2019
fd62385
fix lint
Feb 26, 2019
4ab6a2c
- update py formatting tests
Feb 26, 2019
eb98da7
py27 fixes
Feb 26, 2019
f2acd4e
revert version change
Feb 26, 2019
ba926f1
py27 and py37 support w/ unicode check
Feb 26, 2019
0b24ca8
str/unicode detection without version flag
Feb 27, 2019
53aa524
- fix pr comments
Feb 27, 2019
5a2159b
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 27, 2019
fc74d02
meta
Feb 27, 2019
1f30b8e
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 27, 2019
e242200
Merge branch 'master' into issue189-number-formatting
Marc-Andre-Rivet Feb 27, 2019
7a7c8ff
- typo
Feb 28, 2019
a44b733
Merge branch 'issue189-number-formatting' of github.com:plotly/dash-t…
Feb 28, 2019
7916b29
- fix tests
Feb 28, 2019
fe73302
- spellcheck
Feb 28, 2019
a4c6789
fix tests
Feb 28, 2019
29b2858
expected!
Feb 28, 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
16 changes: 14 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ jobs:

"node":
docker:
- image: circleci/node:8.11.3
- image: circleci/python:3.6.7-node

steps:
- checkout

- run:
name: Create virtual env
command: python -m venv || virtualenv venv

- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "package-lock.json" }}-{{ checksum "package.json" }}

Expand All @@ -159,9 +163,17 @@ jobs:
paths:
- node_modules

- run:
name: Install requirements
command: |
. venv/bin/activate
pip install -r requirements-base.txt --quiet

- run:
name: Run eslint
command: npm run lint
command: |
. venv/bin/activate
npm run lint
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add some flake linting

when: always


Expand Down
40 changes: 39 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
{
"tslint.jsEnable": true
"tslint.jsEnable": true,
"cSpell.allowCompoundWords": true,
"cSpell.ignorePaths": [
"**/package.json",
"**/package-lock.json",
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/**",
".vscode",
"typings"
],
"cSpell.ignoreRegExpList": [
"'"
],
"cSpell.language": "en",
"cSpell.diagnosticLevel": "Error",
"cSpell.languageSettings": [
{ "languageId": "*", "dictionaries": ["fonts", "css", "html", "npm", "typescript", "python"]}
],
"cSpell.words": [
"atto",
"deletable",
"femto",
"giga",
"ints",
"milli",
"nully",
"peta",
"pico",
"plotly",
"selectable",
"tera",
"tooltips",
"uneditable",
"yocto",
"yotta",
"zepto",
"zetta"
]
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [3.5.0] - 2019-02-25
### Added
[#189](https://github.com/plotly/dash-table/issues/189)
- Added `format` nested prop to columns
- Applied to columns with `type=numeric` (more to come)
- Uses [d3-format](https://github.com/d3/d3-format) under the hood
- `format.locale` for localization configuration
- `format.prefix` for SI prefix configuration
- `format.specifier` for formatting configuration
- `format.separate_4digits` to configure grouping behavior for numbers with 4 digits or less
- Python helpers (dash_table.FormatTemplate)
- Added `locale_format` prop to table (default localization configuration, merged with column.format.locale)

[#342](https://github.com/plotly/dash-core/issues/342)
- Added `column_type` condition to style `if`; allows applying styles based on the type of the column for props
- `style_cell_conditional`
Expand Down
31 changes: 27 additions & 4 deletions dash_table/DataTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@ class DataTable(Component):
active.
- columns (list; optional): Columns describes various aspects about each individual column.
`name` and `id` are the only required parameters.
- locale_format (optional): The localization specific formatting information applied to all columns in the table.

This prop is derived from the [d3.formatLocale](https://github.com/d3/d3-format#formatLocale) data structure specification.

When left unspecified, each individual nested prop will default to a pre-determined value.

'symbol': (default: ['$', '']) a list of two strings representing the
prefix and suffix symbols. Typically used for currency, and implemented using d3's
currency format, but you can use this for other symbols such as measurement units.
'decimal': (default: '.') the string used for the decimal separator
'group': (default: ',') the string used for the groups separator
'grouping': (default: [3]) a list of integers representing the grouping pattern
'numerals': a list of ten strings used as replacements for numbers 0-9
'percent': (default: '%') the string used for the percentage symbol
'separate_4digits': (default: True) separate integers with 4-digits or less. locale_format has the following type: dict containing keys 'symbol', 'decimal', 'group', 'grouping', 'numerals', 'percent', 'separate_4digits'.
Those keys have the following types:
- symbol (list; optional)
- decimal (string; optional)
- group (string; optional)
- grouping (list; optional)
- numerals (list; optional)
- percent (string; optional)
- separate_4digits (boolean; optional)
- content_style (a value equal to: 'fit', 'grow'; optional): `content_style` toggles between a set of CSS styles for
two common behaviors:
- `fit`: The table container's width be equal to the width of its content.
Expand Down Expand Up @@ -208,7 +231,7 @@ class DataTable(Component):
in the list. Higher priority (more specific) conditional
tooltips should be put at the beginning of the list.

The `if` refers to the condtion that needs to be fulfilled
The `if` refers to the condition that needs to be fulfilled
in order for the associated tooltip configuration to be
used. If multiple conditions are defined, all conditions
must be met for the tooltip to be used by a cell.
Expand Down Expand Up @@ -387,12 +410,12 @@ class DataTable(Component):
Subscribe to [https://github.com/plotly/dash-table/issues/168](https://github.com/plotly/dash-table/issues/168)
for updates on the dropdown API."""
@_explicitize_args
def __init__(self, active_cell=Component.UNDEFINED, columns=Component.UNDEFINED, content_style=Component.UNDEFINED, css=Component.UNDEFINED, data=Component.UNDEFINED, data_previous=Component.UNDEFINED, data_timestamp=Component.UNDEFINED, editable=Component.UNDEFINED, end_cell=Component.UNDEFINED, id=Component.UNDEFINED, is_focused=Component.UNDEFINED, merge_duplicate_headers=Component.UNDEFINED, n_fixed_columns=Component.UNDEFINED, n_fixed_rows=Component.UNDEFINED, row_deletable=Component.UNDEFINED, row_selectable=Component.UNDEFINED, selected_cells=Component.UNDEFINED, selected_rows=Component.UNDEFINED, start_cell=Component.UNDEFINED, style_as_list_view=Component.UNDEFINED, pagination_mode=Component.UNDEFINED, pagination_settings=Component.UNDEFINED, navigation=Component.UNDEFINED, column_conditional_dropdowns=Component.UNDEFINED, column_static_dropdown=Component.UNDEFINED, column_static_tooltip=Component.UNDEFINED, column_conditional_tooltips=Component.UNDEFINED, tooltips=Component.UNDEFINED, tooltip_delay=Component.UNDEFINED, tooltip_duration=Component.UNDEFINED, filtering=Component.UNDEFINED, filtering_settings=Component.UNDEFINED, filtering_type=Component.UNDEFINED, filtering_types=Component.UNDEFINED, sorting=Component.UNDEFINED, sorting_type=Component.UNDEFINED, sorting_settings=Component.UNDEFINED, sorting_treat_empty_string_as_none=Component.UNDEFINED, style_table=Component.UNDEFINED, style_cell=Component.UNDEFINED, style_data=Component.UNDEFINED, style_filter=Component.UNDEFINED, style_header=Component.UNDEFINED, style_cell_conditional=Component.UNDEFINED, style_data_conditional=Component.UNDEFINED, style_filter_conditional=Component.UNDEFINED, style_header_conditional=Component.UNDEFINED, virtualization=Component.UNDEFINED, derived_viewport_data=Component.UNDEFINED, derived_viewport_indices=Component.UNDEFINED, derived_viewport_selected_rows=Component.UNDEFINED, derived_virtual_data=Component.UNDEFINED, derived_virtual_indices=Component.UNDEFINED, derived_virtual_selected_rows=Component.UNDEFINED, dropdown_properties=Component.UNDEFINED, **kwargs):
self._prop_names = ['active_cell', 'columns', 'content_style', 'css', 'data', 'data_previous', 'data_timestamp', 'editable', 'end_cell', 'id', 'is_focused', 'merge_duplicate_headers', 'n_fixed_columns', 'n_fixed_rows', 'row_deletable', 'row_selectable', 'selected_cells', 'selected_rows', 'start_cell', 'style_as_list_view', 'pagination_mode', 'pagination_settings', 'navigation', 'column_conditional_dropdowns', 'column_static_dropdown', 'column_static_tooltip', 'column_conditional_tooltips', 'tooltips', 'tooltip_delay', 'tooltip_duration', 'filtering', 'filtering_settings', 'filtering_type', 'filtering_types', 'sorting', 'sorting_type', 'sorting_settings', 'sorting_treat_empty_string_as_none', 'style_table', 'style_cell', 'style_data', 'style_filter', 'style_header', 'style_cell_conditional', 'style_data_conditional', 'style_filter_conditional', 'style_header_conditional', 'virtualization', 'derived_viewport_data', 'derived_viewport_indices', 'derived_viewport_selected_rows', 'derived_virtual_data', 'derived_virtual_indices', 'derived_virtual_selected_rows', 'dropdown_properties']
def __init__(self, active_cell=Component.UNDEFINED, columns=Component.UNDEFINED, locale_format=Component.UNDEFINED, content_style=Component.UNDEFINED, css=Component.UNDEFINED, data=Component.UNDEFINED, data_previous=Component.UNDEFINED, data_timestamp=Component.UNDEFINED, editable=Component.UNDEFINED, end_cell=Component.UNDEFINED, id=Component.UNDEFINED, is_focused=Component.UNDEFINED, merge_duplicate_headers=Component.UNDEFINED, n_fixed_columns=Component.UNDEFINED, n_fixed_rows=Component.UNDEFINED, row_deletable=Component.UNDEFINED, row_selectable=Component.UNDEFINED, selected_cells=Component.UNDEFINED, selected_rows=Component.UNDEFINED, start_cell=Component.UNDEFINED, style_as_list_view=Component.UNDEFINED, pagination_mode=Component.UNDEFINED, pagination_settings=Component.UNDEFINED, navigation=Component.UNDEFINED, column_conditional_dropdowns=Component.UNDEFINED, column_static_dropdown=Component.UNDEFINED, column_static_tooltip=Component.UNDEFINED, column_conditional_tooltips=Component.UNDEFINED, tooltips=Component.UNDEFINED, tooltip_delay=Component.UNDEFINED, tooltip_duration=Component.UNDEFINED, filtering=Component.UNDEFINED, filtering_settings=Component.UNDEFINED, filtering_type=Component.UNDEFINED, filtering_types=Component.UNDEFINED, sorting=Component.UNDEFINED, sorting_type=Component.UNDEFINED, sorting_settings=Component.UNDEFINED, sorting_treat_empty_string_as_none=Component.UNDEFINED, style_table=Component.UNDEFINED, style_cell=Component.UNDEFINED, style_data=Component.UNDEFINED, style_filter=Component.UNDEFINED, style_header=Component.UNDEFINED, style_cell_conditional=Component.UNDEFINED, style_data_conditional=Component.UNDEFINED, style_filter_conditional=Component.UNDEFINED, style_header_conditional=Component.UNDEFINED, virtualization=Component.UNDEFINED, derived_viewport_data=Component.UNDEFINED, derived_viewport_indices=Component.UNDEFINED, derived_viewport_selected_rows=Component.UNDEFINED, derived_virtual_data=Component.UNDEFINED, derived_virtual_indices=Component.UNDEFINED, derived_virtual_selected_rows=Component.UNDEFINED, dropdown_properties=Component.UNDEFINED, **kwargs):
self._prop_names = ['active_cell', 'columns', 'locale_format', 'content_style', 'css', 'data', 'data_previous', 'data_timestamp', 'editable', 'end_cell', 'id', 'is_focused', 'merge_duplicate_headers', 'n_fixed_columns', 'n_fixed_rows', 'row_deletable', 'row_selectable', 'selected_cells', 'selected_rows', 'start_cell', 'style_as_list_view', 'pagination_mode', 'pagination_settings', 'navigation', 'column_conditional_dropdowns', 'column_static_dropdown', 'column_static_tooltip', 'column_conditional_tooltips', 'tooltips', 'tooltip_delay', 'tooltip_duration', 'filtering', 'filtering_settings', 'filtering_type', 'filtering_types', 'sorting', 'sorting_type', 'sorting_settings', 'sorting_treat_empty_string_as_none', 'style_table', 'style_cell', 'style_data', 'style_filter', 'style_header', 'style_cell_conditional', 'style_data_conditional', 'style_filter_conditional', 'style_header_conditional', 'virtualization', 'derived_viewport_data', 'derived_viewport_indices', 'derived_viewport_selected_rows', 'derived_virtual_data', 'derived_virtual_indices', 'derived_virtual_selected_rows', 'dropdown_properties']
self._type = 'DataTable'
self._namespace = 'dash_table'
self._valid_wildcard_attributes = []
self.available_properties = ['active_cell', 'columns', 'content_style', 'css', 'data', 'data_previous', 'data_timestamp', 'editable', 'end_cell', 'id', 'is_focused', 'merge_duplicate_headers', 'n_fixed_columns', 'n_fixed_rows', 'row_deletable', 'row_selectable', 'selected_cells', 'selected_rows', 'start_cell', 'style_as_list_view', 'pagination_mode', 'pagination_settings', 'navigation', 'column_conditional_dropdowns', 'column_static_dropdown', 'column_static_tooltip', 'column_conditional_tooltips', 'tooltips', 'tooltip_delay', 'tooltip_duration', 'filtering', 'filtering_settings', 'filtering_type', 'filtering_types', 'sorting', 'sorting_type', 'sorting_settings', 'sorting_treat_empty_string_as_none', 'style_table', 'style_cell', 'style_data', 'style_filter', 'style_header', 'style_cell_conditional', 'style_data_conditional', 'style_filter_conditional', 'style_header_conditional', 'virtualization', 'derived_viewport_data', 'derived_viewport_indices', 'derived_viewport_selected_rows', 'derived_virtual_data', 'derived_virtual_indices', 'derived_virtual_selected_rows', 'dropdown_properties']
self.available_properties = ['active_cell', 'columns', 'locale_format', 'content_style', 'css', 'data', 'data_previous', 'data_timestamp', 'editable', 'end_cell', 'id', 'is_focused', 'merge_duplicate_headers', 'n_fixed_columns', 'n_fixed_rows', 'row_deletable', 'row_selectable', 'selected_cells', 'selected_rows', 'start_cell', 'style_as_list_view', 'pagination_mode', 'pagination_settings', 'navigation', 'column_conditional_dropdowns', 'column_static_dropdown', 'column_static_tooltip', 'column_conditional_tooltips', 'tooltips', 'tooltip_delay', 'tooltip_duration', 'filtering', 'filtering_settings', 'filtering_type', 'filtering_types', 'sorting', 'sorting_type', 'sorting_settings', 'sorting_treat_empty_string_as_none', 'style_table', 'style_cell', 'style_data', 'style_filter', 'style_header', 'style_cell_conditional', 'style_data_conditional', 'style_filter_conditional', 'style_header_conditional', 'virtualization', 'derived_viewport_data', 'derived_viewport_indices', 'derived_viewport_selected_rows', 'derived_virtual_data', 'derived_virtual_indices', 'derived_virtual_selected_rows', 'dropdown_properties']
self.available_wildcard_properties = []

_explicit_args = kwargs.pop('_explicit_args')
Expand Down
Loading