-
-
Notifications
You must be signed in to change notification settings - Fork 73
Conversation
PropTypes.number | ||
]), | ||
hidden: PropTypes.bool, | ||
id: PropTypes.string.isRequired, |
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.
Only the id is required
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.
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
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.
We currently revert to 'id' when there is no name
@@ -99,7 +121,7 @@ export const propTypes = { | |||
row_selectable: PropTypes.oneOf(['single', 'multi', false]), | |||
selected_cell: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)), | |||
selected_rows: PropTypes.arrayOf(PropTypes.number), | |||
setProps: PropTypes.any, | |||
setProps: PropTypes.func, | |||
start_cell: PropTypes.arrayOf(PropTypes.number), | |||
style_as_list_view: PropTypes.bool, | |||
|
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.
dropdown_properties can not be typed better as it is a lightweight dictionary object for columns.
src/dash-table/Table.js
Outdated
value: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.string | ||
]) |
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.
The only dropdown values that make sense at the moment are strings and numbers. We may expand on that later.
type?: ColumnType; | ||
} | ||
|
||
interface IDatumObject { | ||
[key: string]: any; | ||
} | ||
|
||
interface IDropdownValue { | ||
label: string; | ||
value: string | number; |
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.
Matching props dropdown value typing
@@ -77,7 +77,32 @@ export const defaultProps = { | |||
|
|||
export const propTypes = { | |||
active_cell: PropTypes.array, | |||
columns: PropTypes.arrayOf(PropTypes.object), | |||
columns: PropTypes.arrayOf(PropTypes.shape({ | |||
clearable: PropTypes.bool, |
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.
could we add docstrings to all of these as well?
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.
Sure. I'll create another issue, mark it as P1, and link it to the example below.
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.
Here #163
columns: PropTypes.arrayOf(PropTypes.object), | ||
columns: PropTypes.arrayOf(PropTypes.shape({ | ||
clearable: PropTypes.bool, | ||
deletable: PropTypes.oneOfType([ |
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.
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.
*/
selector: PropTypes.string, | ||
rule: PropTypes.string | ||
selector: PropTypes.string.isRequired, | ||
rule: PropTypes.string.isRequired |
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.
Added 'isRequired' to nested props that absolutely need to be present
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.
Looks good to me, not approving so that @chriddyp can continue discussing name
prop if he wants
For #143.
improve external facing props types
improve internal facing props types