Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | // Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
import React from 'react';
import PropTypes from 'prop-types';
import ButtonIcon from '../../button-icons/';
import { Checkbox } from '../../checkbox/base/example';
import {
Table,
THead,
ColumnTh,
THeadTr,
ColumnHeader,
TBody,
TBodyTr,
RowTh,
Td,
ReadOnlyCell,
DataTableContext
} from '../';
/// ////////////////////////////////////////
// Partial(s)
/// ////////////////////////////////////////
const checkboxRadioGroupHeaderId = 'check-group-header';
const HeadRowData = props => (
<THeadTr>
<ColumnTh isDataTable>
<Checkbox
checked={props.checked}
groupId={checkboxRadioGroupHeaderId}
hideLabel
id="checkbox-all"
label="Select all"
labelId="check-button-label-all"
isDataTable
/>
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Opportunity Name" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Account Name" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Close Date" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Stage" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Confidence" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Amount" />
</ColumnTh>
<ColumnTh>
<ColumnHeader columnName="Contact" />
</ColumnTh>
<ColumnTh columnName="Actions" isAssistiveText />
</THeadTr>
);
HeadRowData.propTypes = {
checked: PropTypes.bool
};
const RowData = props => (
<TBodyTr>
<Td data-label="Select Row" type="base">
<Checkbox
checked={props.checked}
groupId={checkboxRadioGroupHeaderId}
hideLabel
id={`checkbox-0${props.index}`}
label={`Select item ${props.index}`}
labelId={`check-button-label-0${props.index}`}
isDataTable
/>
</Td>
<RowTh data-label="Opportunity Name" type="base">
<ReadOnlyCell cellText={props.title} />
</RowTh>
<Td data-label="Account Name" type="base">
<ReadOnlyCell cellText="Cloudhub" />
</Td>
<Td data-label="Close Date" type="base">
<ReadOnlyCell cellText="4/14/2015" />
</Td>
<Td data-label="Prospecting" type="base">
<ReadOnlyCell cellText="Prospecting" />
</Td>
<Td data-label="Confidence" type="base">
<ReadOnlyCell cellText="20%" />
</Td>
<Td data-label="Amount" type="base">
<ReadOnlyCell cellText="$25k" />
</Td>
<Td data-label="Contact" type="base">
<DataTableContext.Provider value={{ isActionableMode: true }}>
<ReadOnlyCell cellLink cellText="jrogers@cloudhub.com" />
</DataTableContext.Provider>
</Td>
<Td data-label="Actions" isShrunken type="base">
<ButtonIcon
assistiveText="Show More"
className="slds-button_icon-border-filled slds-button_icon-x-small"
iconClassName="slds-button__icon_hint slds-button__icon_small"
symbol="down"
title="Show More"
/>
</Td>
</TBodyTr>
);
RowData.propTypes = {
checked: PropTypes.bool,
index: PropTypes.string,
title: PropTypes.string
};
/// ///////////////////////////////////////////
// State Constructor(s)
/// ///////////////////////////////////////////
export const Stacked = props => (
<Table
isBordered
isResponsiveStacked
type="base"
ariaLabel="Example stacked table"
>
<THead>
<HeadRowData />
</THead>
<TBody>
<RowData index="1" title="Cloudhub" />
<RowData index="2" title="Cloudhub + Anypoint Connectors" />
</TBody>
</Table>
);
export const Horizontal = props => (
<Table
isBordered
isResponsive
type="base"
ariaLabel="Example horizontal table"
>
<THead>
<HeadRowData />
</THead>
<TBody>
<RowData index="1" title="Cloudhub" />
<RowData index="2" title="Cloudhub + Anypoint Connectors" />
</TBody>
</Table>
);
|