| 1 |
/* eslint-disable no-console */ |
| 2 |
import { IRow, ICell, IActions, EditableTextCell } from '../components/Table'; |
| 3 |
|
| 4 |
export const columns: (ICell | string)[] = [ |
| 5 |
{ title: 'Header cell' }, |
| 6 |
'Branches', |
| 7 |
{ title: 'Pull requests' }, |
| 8 |
'Workspaces', |
| 9 |
{ |
| 10 |
title: 'Last Commit' |
| 11 |
} |
| 12 |
]; |
| 13 |
|
| 14 |
export const rows: IRow[] = [ |
| 15 |
{ |
| 16 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 17 |
}, |
| 18 |
{ |
| 19 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 20 |
}, |
| 21 |
{ |
| 22 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 23 |
}, |
| 24 |
{ |
| 25 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 26 |
}, |
| 27 |
{ |
| 28 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 29 |
}, |
| 30 |
{ |
| 31 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 32 |
}, |
| 33 |
{ |
| 34 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 35 |
}, |
| 36 |
{ |
| 37 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 38 |
}, |
| 39 |
{ |
| 40 |
cells: ['one', 'two', 'three', 'four', 'five'] |
| 41 |
} |
| 42 |
]; |
| 43 |
|
| 44 |
export const editableColumns: (ICell | string)[] = [ |
| 45 |
'Text input col 1', |
| 46 |
'Disabled text input col 2', |
| 47 |
'Text input col 3', |
| 48 |
'Text input col 4' |
| 49 |
]; |
| 50 |
|
| 51 |
export const editableRows: IRow[] = [ |
| 52 |
{ |
| 53 |
isEditable: true, |
| 54 |
cells: [ |
| 55 |
{ |
| 56 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 57 |
<EditableTextCell |
| 58 |
value={value} |
| 59 |
rowIndex={rowIndex} |
| 60 |
cellIndex={cellIndex} |
| 61 |
props={props} |
| 62 |
handleTextInputChange={() => {}} |
| 63 |
inputAriaLabel="Row 1 cell 1 content" |
| 64 |
/> |
| 65 |
), |
| 66 |
props: { |
| 67 |
value: 'Row 1 cell 1 content', |
| 68 |
name: 'uniqueIdRow1Cell1' |
| 69 |
} |
| 70 |
}, |
| 71 |
{ |
| 72 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 73 |
<EditableTextCell |
| 74 |
value={value} |
| 75 |
rowIndex={rowIndex} |
| 76 |
cellIndex={cellIndex} |
| 77 |
props={props} |
| 78 |
isDisabled |
| 79 |
handleTextInputChange={() => {}} |
| 80 |
inputAriaLabel="Row 1 cell 2 content" |
| 81 |
/> |
| 82 |
), |
| 83 |
props: { |
| 84 |
value: 'Row 1 cell 2, disabled content', |
| 85 |
name: 'uniqueIdRow1Cell2' |
| 86 |
} |
| 87 |
}, |
| 88 |
{ |
| 89 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 90 |
<EditableTextCell |
| 91 |
value={value} |
| 92 |
rowIndex={rowIndex} |
| 93 |
cellIndex={cellIndex} |
| 94 |
props={props} |
| 95 |
handleTextInputChange={() => {}} |
| 96 |
inputAriaLabel="Row 1 cell 3 content" |
| 97 |
/> |
| 98 |
), |
| 99 |
props: { |
| 100 |
value: 'Row 1 cell 3 content', |
| 101 |
name: 'uniqueIdRow1Cell3' |
| 102 |
} |
| 103 |
}, |
| 104 |
{ |
| 105 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 106 |
<EditableTextCell |
| 107 |
value={value} |
| 108 |
rowIndex={rowIndex} |
| 109 |
cellIndex={cellIndex} |
| 110 |
props={props} |
| 111 |
handleTextInputChange={() => {}} |
| 112 |
inputAriaLabel="Row 1 cell 4 content" |
| 113 |
/> |
| 114 |
), |
| 115 |
props: { |
| 116 |
value: 'Row 1 cell 4 content', |
| 117 |
name: 'uniqueIdRow1Cell4' |
| 118 |
} |
| 119 |
} |
| 120 |
] |
| 121 |
}, |
| 122 |
{ |
| 123 |
isEditable: false, |
| 124 |
cells: [ |
| 125 |
{ |
| 126 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 127 |
<EditableTextCell |
| 128 |
value={value} |
| 129 |
rowIndex={rowIndex} |
| 130 |
cellIndex={cellIndex} |
| 131 |
props={props} |
| 132 |
handleTextInputChange={() => {}} |
| 133 |
inputAriaLabel="Row 1 cell 1 content" |
| 134 |
/> |
| 135 |
), |
| 136 |
props: { |
| 137 |
value: 'Row 2 cell 1 content', |
| 138 |
name: 'uniqueIdRow2Cell1' |
| 139 |
} |
| 140 |
}, |
| 141 |
{ |
| 142 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 143 |
<EditableTextCell |
| 144 |
value={value} |
| 145 |
rowIndex={rowIndex} |
| 146 |
cellIndex={cellIndex} |
| 147 |
props={props} |
| 148 |
isDisabled |
| 149 |
handleTextInputChange={() => {}} |
| 150 |
inputAriaLabel="Row 2 cell 2 content" |
| 151 |
/> |
| 152 |
), |
| 153 |
props: { |
| 154 |
value: 'Row 2 cell 2, disabled content', |
| 155 |
name: 'uniqueIdRow2Cell2' |
| 156 |
} |
| 157 |
}, |
| 158 |
{ |
| 159 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 160 |
<EditableTextCell |
| 161 |
value={value} |
| 162 |
rowIndex={rowIndex} |
| 163 |
cellIndex={cellIndex} |
| 164 |
props={props} |
| 165 |
handleTextInputChange={() => {}} |
| 166 |
inputAriaLabel="Row 2 cell 3 content" |
| 167 |
/> |
| 168 |
), |
| 169 |
props: { |
| 170 |
value: 'Row 2 cell 3 content', |
| 171 |
name: 'uniqueIdRow2Cell3' |
| 172 |
} |
| 173 |
}, |
| 174 |
{ |
| 175 |
title: (value: string, rowIndex: number, cellIndex: number, props: any) => ( |
| 176 |
<EditableTextCell |
| 177 |
value={value} |
| 178 |
rowIndex={rowIndex} |
| 179 |
cellIndex={cellIndex} |
| 180 |
props={props} |
| 181 |
handleTextInputChange={() => {}} |
| 182 |
inputAriaLabel="Row 2 cell 4 content" |
| 183 |
/> |
| 184 |
), |
| 185 |
props: { |
| 186 |
value: 'Row 2 cell 4 content', |
| 187 |
name: 'uniqueIdRow2Cell4' |
| 188 |
} |
| 189 |
} |
| 190 |
] |
| 191 |
} |
| 192 |
]; |
| 193 |
|
| 194 |
export const actions: IActions = [ |
| 195 |
{ |
| 196 |
title: 'Some action', |
| 197 |
onClick: (event: React.MouseEvent, rowId: number) => |
| 198 |
// tslint:disable-next-line:no-console |
| 199 |
console.log('clicked on Some action, on row: ', rowId) |
| 200 |
}, |
| 201 |
{ |
| 202 |
title: <div>Another action</div>, |
| 203 |
onClick: (event: React.MouseEvent, rowId: number) => |
| 204 |
// tslint:disable-next-line:no-console |
| 205 |
console.log('clicked on Another action, on row: ', rowId) |
| 206 |
}, |
| 207 |
{ |
| 208 |
isSeparator: true, |
| 209 |
onClick: null |
| 210 |
}, |
| 211 |
{ |
| 212 |
title: 'Third action', |
| 213 |
onClick: (event: React.MouseEvent, rowId: number) => |
| 214 |
// tslint:disable-next-line:no-console |
| 215 |
console.log('clicked on Third action, on row: ', rowId) |
| 216 |
} |
| 217 |
]; |