Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

3.1 issue143 props typing#158

Merged
Marc-Andre-Rivet merged 7 commits into
masterfrom
3.1-issue143-props-typing
Oct 23, 2018
Merged

3.1 issue143 props typing#158
Marc-Andre-Rivet merged 7 commits into
masterfrom
3.1-issue143-props-typing

Conversation

@Marc-Andre-Rivet

@Marc-Andre-Rivet Marc-Andre-Rivet commented Oct 22, 2018

Copy link
Copy Markdown
Contributor

For #143.

  • improve external facing props types

    • columns
    • data_timestamp
    • setProps
    • required props
  • improve internal facing props types

    • dropdown props

Comment thread src/dash-table/Table.js
PropTypes.number
]),
hidden: PropTypes.bool,
id: PropTypes.string.isRequired,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only the id is required

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what happens if name isn't supplied? I think we should make both id and name required to force our users to supply both and standardize on a convention

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We currently revert to 'id' when there is no name

Comment thread src/dash-table/Table.js
setProps: PropTypes.func,
start_cell: PropTypes.arrayOf(PropTypes.number),
style_as_list_view: PropTypes.bool,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

dropdown_properties can not be typed better as it is a lightweight dictionary object for columns.

Comment thread src/dash-table/Table.js Outdated
value: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The only dropdown values that make sense at the moment are strings and numbers. We may expand on that later.


interface IDropdownValue {
label: string;
value: string | number;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Matching props dropdown value typing

@chriddyp
chriddyp temporarily deployed to dash-table-review-pr-158 October 22, 2018 21:16 Inactive
Comment thread src/dash-table/Table.js
active_cell: PropTypes.array,
columns: PropTypes.arrayOf(PropTypes.object),
columns: PropTypes.arrayOf(PropTypes.shape({
clearable: PropTypes.bool,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could we add docstrings to all of these as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll create another issue, mark it as P1, and link it to the example below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here #163

Comment thread src/dash-table/Table.js
columns: PropTypes.arrayOf(PropTypes.object),
columns: PropTypes.arrayOf(PropTypes.shape({
clearable: PropTypes.bool,
deletable: PropTypes.oneOfType([

@chriddyp chriddyp Oct 23, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For example:

/**
 * If True, the user can delete the column by clicking on a little `x` button on the
 * column.
 * If there are multi-header columns (via setting `name` to an array of strings)
 * with merged column headers, then you can choose which column header row
 * to display the "x" in by supplying a column row index. For example, `0` will
 * display the "x" on the first row, `1` on the second row. If the "x" appears on
 * a merged column, then deleting the column will delete all of the merged columns
 * associated with it.
 */

@chriddyp
chriddyp temporarily deployed to dash-table-review-pr-158 October 23, 2018 15:41 Inactive
@chriddyp
chriddyp temporarily deployed to dash-table-review-pr-158 October 23, 2018 15:43 Inactive
Comment thread src/dash-table/Table.js
selector: PropTypes.string,
rule: PropTypes.string
selector: PropTypes.string.isRequired,
rule: PropTypes.string.isRequired

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added 'isRequired' to nested props that absolutely need to be present

@valentijnnieman valentijnnieman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, not approving so that @chriddyp can continue discussing name prop if he wants

@chriddyp
chriddyp temporarily deployed to dash-table-review-pr-158 October 23, 2018 19:51 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants