Adding IDs for select table, fixing backwards compatibility on floating left checkbox (#1208)

* Adding IDs for select all and individual row checkboxes

* Using keyfield const
This commit is contained in:
Devin Clark
2019-01-31 10:06:47 -07:00
committed by Tanner Linsley
parent e0f9d98819
commit de6389cafc
2 changed files with 1522 additions and 1485 deletions
+1518 -1482
View File
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -8,6 +8,7 @@ const defaultSelectInputComponent = props => {
type={props.selectType || 'checkbox'}
aria-label={`${props.checked ? 'Un-select':'Select'} row with id:${props.id}` }
checked={props.checked}
id={props.id}
onClick={e => {
const { shiftKey } = e
e.stopPropagation()
@@ -32,8 +33,8 @@ export default (Component, options) => {
checked,
onClick: toggleSelection,
selectType,
id: row[keyField],
row,
id: `select-${row[keyField]}`
}
return React.createElement(this.props.SelectInputComponent, inputProps)
}
@@ -47,6 +48,7 @@ export default (Component, options) => {
checked,
onClick: toggleAll,
selectType,
id: 'select-all'
}
return React.createElement(SelectAllInputComponent, inputProps)
@@ -73,7 +75,6 @@ export default (Component, options) => {
SelectInputComponent,
...rest
} = this.props
const { floatingLeft = false } = options
const select = {
id: '_selector',
accessor: () => 'x', // this value is not important
@@ -88,7 +89,7 @@ export default (Component, options) => {
style: { textAlign: 'center' },
}
const columns = floatingLeft ? [...originalCols, select] : [select, ...originalCols]
const columns = (options !== undefined && options.floatingLeft === true) ? [...originalCols, select] : [select, ...originalCols]
const extra = {
columns,
}