-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding prop reorder exceptions #1866
Conversation
…to update-prop-order
@alexcjohnson This PR should be ready for review now 🙂 |
@HammadTheOne, should this address #1840 too? I see it's not mentioned above, so I guess not. I built off this branch and see the following for:
Output:
|
@@ -17,7 +17,7 @@ | |||
"private::build:js": "run-s \"private::build -- --mode production\"", | |||
"private::build:js-test": "run-s \"private::build -- --mode development --config webpack.test.config.js\"", | |||
"private::build:js-test-watch": "run-s \"private::build -- --mode development --config webpack.test.config.js --watch\"", | |||
"private::build:backends": "dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json && cp dash_table_base/** dash_table/ && dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json --r-prefix 'dash' --r-suggests 'dash' --jl-prefix 'dash' && black dash_table", | |||
"private::build:backends": "dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json && cp dash_table_base/** dash_table/ && dash-generate-components src/dash-table/dash/DataTable.js dash_table -p package-info.json -k DataTable --r-prefix 'dash' --r-suggests 'dash' --jl-prefix 'dash' && black dash_table", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make prop order explicit for table, I think we should be a little more careful about what order we end up with, especially since this will be reflected in the docs. The first two are right: data
and columns
. And it makes sense to keep derived_*
and the dash standards (loading_state
, persistence
) at the end. Other than that it's currently a bit random, will be a bit hard for users to find what they want. @chriddyp do you want to give this a shot?
@@ -25,7 +25,7 @@ | |||
"test:pyimport": "python -m unittest tests/test_dash_import.py", | |||
"prebuild:js": "cp node_modules/plotly.js/dist/plotly.min.js dash_core_components_base/plotly.min.js", | |||
"build:js": "webpack --mode production", | |||
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components", | |||
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json -k RangeSlider,Slider,DataTable,Dropdown,RadioItems,Checklist --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here, there are some funny orders that I think we should be more careful about. In Checklist
and RadioItems
, what's inline
doing way at the end, past the dash standards and far from any of the other style props? Some of these are alphabetized, other than the ones we explicitly want upfront, but some aren't - can we be consistent about this?
(BTW DataTable
isn't needed in this list 😁)
PropTypes.bool, | ||
PropTypes.arrayOf(PropTypes.bool) | ||
]), | ||
type: PropTypes.oneOf(['any', 'numeric', 'text', 'datetime']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do nested props also get their order preserved by this PR? If not don't worry about it for now, but assuming at some point they will, let's put type
and presentation
up top, right below id
and name
, as these are very important and commonly used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately nested props aren't preserved. For the moment though, I've made the change in d9e386b.
We're getting there, looking good! In the table, let's move |
Oh actually, re: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! 💃
This PR adds an exception conditional for the prop reordering that occurs in
py_components_generation.py
. Previously, the prop order for certaindcc
components anddash-table
was changed in the component JS source files, but these changes aren't reflected in the Python backend as props are reordered alphabetically during Python component generation.With this PR, there is an additional flag for
dash-generate-components
passed with-k (keep-prop-order)
. The argument is a comma-separated string of component names which will be exempt from alphabetical prop reordering. The keyword "ALL" can be passed to exempt all components from a particular package.Closes #1844
Closes #1845
Closes #1840
Contributor Checklist
optionals
CHANGELOG.md