types#ColumnType TypeScript Examples

The following examples show how to use types#ColumnType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: makeData.ts    From react-final-table with MIT License 6 votes vote down vote up
makeSimpleData = <T extends DataType>() => {
  const columns: ColumnType<T>[] = [
    {
      name: 'firstName',
      label: 'First Name',
    },
    {
      name: 'lastName',
      label: 'Last Name',
    },
    {
      name: 'birthDate',
      label: 'Birth Date',
    },
  ];

  const recentDate = date.recent();
  const pastDate = date.past(undefined, recentDate);
  const oldestDate = date.past(100, pastDate);

  const data = [
    {
      firstName: 'Samwise',
      lastName: 'Gamgee',
      birthDate: pastDate.toISOString(),
    },
    {
      firstName: 'Frodo',
      lastName: 'Baggins',
      birthDate: recentDate.toISOString(), // must be youngest for tests
    },
    {
      firstName: 'Bilbo',
      lastName: 'Baggins',
      birthDate: oldestDate.toISOString(),
    },
  ];
  return { columns, data };
}
Example #2
Source File: makeData.ts    From react-final-table with MIT License 5 votes vote down vote up
makeData = <T extends Record<string, unknown>>(
  rowNum: number
): { columns: ColumnType<T>[]; data: UserType[] } => {
  return {
    columns,
    data: randomData.slice(0, rowNum),
  };
}