Skip to content

Commit

Permalink
[DATA GRID] Expand cells (#2418)
Browse files Browse the repository at this point in the history
Data grid cells now can expand and can render individually based upon their schema.
  • Loading branch information
snide authored Oct 10, 2019
1 parent ce3db25 commit 09e6a63
Show file tree
Hide file tree
Showing 33 changed files with 1,047 additions and 357 deletions.
6 changes: 3 additions & 3 deletions src-docs/src/views/datagrid/in_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const columns = [
id: 'amount',
},
{
id: 'phone',
id: 'boolean',
},
{
id: 'version',
Expand All @@ -46,8 +46,8 @@ for (let i = 1; i < 100; i++) {
),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('{{finance.currencySymbol}}{{finance.amount}}'),
phone: fake('{{phone.phoneNumber}}'),
amount: fake('${{finance.amount}}'),
boolean: fake('{{random.boolean}}'),
version: fake('{{system.semver}}'),
});
}
Expand Down
29 changes: 26 additions & 3 deletions src-docs/src/views/datagrid/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { iconTypes } from '../icon/icons';
const columns = [
{
id: 'name',
isExpandable: false,
},
{
id: 'email',
Expand All @@ -21,16 +22,18 @@ const columns = [
{
id: 'account',
dataType: 'numeric',
isExpandable: false,
},
{
id: 'date',
},
{
id: 'amount',
dataType: 'currency',
isExpandable: false,
},
{
id: 'phone',
id: 'json',
},
{
id: 'version',
Expand All @@ -54,12 +57,31 @@ for (let i = 1; i < 5; i++) {
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{finance.amount}}'),
phone: fake('{{phone.phoneNumber}}'),
json: JSON.stringify([
{
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: fake('{{internet.email}}'),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{finance.amount}}'),
version: fake('{{system.semver}}'),
friends: [
{
name: fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'),
email: fake('{{internet.email}}'),
date: fake('{{date.past}}'),
account: fake('{{finance.account}}'),
amount: fake('${{finance.amount}}'),
version: fake('{{system.semver}}'),
},
],
},
]),
version: fake('{{system.semver}}'),
});
}

export default class InMemoryDataGrid extends Component {
export default class DataGridSchema extends Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -116,6 +138,7 @@ export default class InMemoryDataGrid extends Component {
aria-label="Top EUI contributors"
columns={columns}
rowCount={data.length}
inMemory={{ level: 'sorting' }}
renderCellValue={({ rowIndex, columnId }) => {
const value = data[rowIndex][columnId];
return value;
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const iconTypes = [
'empty',
'exit',
'expand',
'expandMini',
'exportAction',
'eye',
'eyeClosed',
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/pagination/customizable_pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export default class extends Component {
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem grow={false}>
<EuiPopover
id="customizablePagination"
button={button}
isOpen={this.state.isPopoverOpen}
closePopover={this.closePopover.bind(this)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
closePopover={[Function]}
display="inlineBlock"
hasArrow={true}
id="customizablePagination"
isOpen={false}
ownFocus={false}
panelPaddingSize="none"
Expand All @@ -341,7 +340,6 @@ exports[`EuiInMemoryTable behavior pagination 1`] = `
>
<div
className="euiPopover euiPopover--anchorUpRight euiPopover--withTitle"
id="customizablePagination"
onKeyDown={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
Expand Down
7 changes: 6 additions & 1 deletion src/components/button/button_icon/button_icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export const EuiButtonIcon: FunctionComponent<Props> = ({
buttonRef,
...rest
}) => {
if (!rest['aria-label'] && !rest['aria-labelledby']) {
const ariaHidden = rest['aria-hidden'];
const isAriaHidden = ariaHidden === 'true' || ariaHidden === true;

if (!rest['aria-label'] && !rest['aria-labelledby'] && !isAriaHidden) {
console.warn(
`EuiButtonIcon requires aria-label or aria-labelledby to be specified because icon-only
buttons are screen-reader-inaccessible without them.`
Expand Down Expand Up @@ -117,6 +120,7 @@ export const EuiButtonIcon: FunctionComponent<Props> = ({

return (
<a
tabIndex={isAriaHidden ? -1 : undefined}
className={classes}
href={href}
target={target}
Expand All @@ -130,6 +134,7 @@ export const EuiButtonIcon: FunctionComponent<Props> = ({

return (
<button
tabIndex={isAriaHidden ? -1 : undefined}
disabled={isDisabled}
className={classes}
type={type}
Expand Down
Loading

0 comments on commit 09e6a63

Please sign in to comment.