2017-09-27 02:46:00 +08:00
|
|
|
import { Table } from 'mailspring-component-kit';
|
2016-05-06 06:21:41 +08:00
|
|
|
|
|
|
|
export const testData = {
|
|
|
|
columns: ['col1', 'col2', 'col3'],
|
2017-09-27 02:33:08 +08:00
|
|
|
rows: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
|
|
|
|
};
|
2016-05-06 06:21:41 +08:00
|
|
|
|
2016-07-29 02:37:43 +08:00
|
|
|
export const testDataUneven = {
|
|
|
|
columns: ['col1', 'col2', 'col3'],
|
2017-09-27 02:33:08 +08:00
|
|
|
rows: [[1, 2], [4, 5, 6], [7, 8]],
|
|
|
|
};
|
2016-07-29 02:37:43 +08:00
|
|
|
|
2016-07-29 05:05:37 +08:00
|
|
|
export const testDataEmpty = {
|
|
|
|
columns: ['col1', 'col2', ''],
|
2017-09-27 02:33:08 +08:00
|
|
|
rows: [[1, 2], [4, 5, 6], ['', ''], []],
|
|
|
|
};
|
2016-07-29 05:05:37 +08:00
|
|
|
|
2016-05-06 06:21:41 +08:00
|
|
|
class TestSource extends Table.TableDataSource {
|
|
|
|
setRows(rows) {
|
|
|
|
const data = {
|
|
|
|
rows: [...rows],
|
|
|
|
columns: this.columns(),
|
2017-09-27 02:33:08 +08:00
|
|
|
};
|
|
|
|
return new TestSource(data);
|
2016-05-06 06:21:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const testDataSource = new TestSource(testData);
|
2016-05-06 06:21:41 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const testDataSourceUneven = new TestSource(testDataUneven);
|
2016-07-29 02:37:43 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const testDataSourceEmpty = new TestSource(testDataEmpty);
|
2016-07-29 05:05:37 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const selection = { colIdx: 0, rowIdx: 0, key: null };
|
2016-05-06 06:21:41 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const cellProps = {
|
|
|
|
tableDataSource: testDataSource,
|
|
|
|
selection,
|
|
|
|
colIdx: 0,
|
|
|
|
rowIdx: 0,
|
|
|
|
onSetSelection: () => {},
|
|
|
|
onCellEdited: () => {},
|
|
|
|
};
|
2016-05-06 06:21:41 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const rowProps = { tableDataSource: testDataSource, selection, rowIdx: 0 };
|
2016-05-06 06:21:41 +08:00
|
|
|
|
2017-09-27 02:33:08 +08:00
|
|
|
export const tableProps = {
|
|
|
|
tableDataSource: testDataSource,
|
|
|
|
selection,
|
|
|
|
onSetSelection: () => {},
|
|
|
|
onShiftSelection: () => {},
|
|
|
|
onCellEdited: () => {},
|
|
|
|
};
|