(column: ColumnPropsWithDefaults, index: number)
| 437 | ); |
| 438 | |
| 439 | const createHeader = (column: ColumnPropsWithDefaults, index: number) => { |
| 440 | const { |
| 441 | columnData, |
| 442 | dataKey, |
| 443 | defaultSortDirection, |
| 444 | disableSort, |
| 445 | headerRenderer, |
| 446 | id: columnId, |
| 447 | label |
| 448 | } = column; |
| 449 | const sortEnabled = !disableSort && sort; |
| 450 | |
| 451 | const classNames = clsx( |
| 452 | "ReactVirtualized__Table__headerColumn", |
| 453 | headerClassName, |
| 454 | column.headerClassName, |
| 455 | { |
| 456 | ReactVirtualized__Table__sortableHeaderColumn: sortEnabled |
| 457 | } |
| 458 | ); |
| 459 | const headerColumnStyle = getFlexStyleForColumn(column, { |
| 460 | ...headerStyle, |
| 461 | ...column.headerStyle |
| 462 | }); |
| 463 | |
| 464 | const renderedHeader = headerRenderer({ |
| 465 | columnData, |
| 466 | dataKey, |
| 467 | disableSort, |
| 468 | label, |
| 469 | sortBy, |
| 470 | sortDirection |
| 471 | }); |
| 472 | |
| 473 | let headerOnClick: |
| 474 | | (( |
| 475 | event: |
| 476 | | MouseEvent<HTMLDivElement> |
| 477 | | KeyboardEvent<HTMLDivElement> |
| 478 | ) => void) |
| 479 | | undefined, |
| 480 | headerOnKeyDown: |
| 481 | | ((event: KeyboardEvent<HTMLDivElement>) => void) |
| 482 | | undefined, |
| 483 | headerTabIndex: number | undefined, |
| 484 | headerAriaSort: AriaAttributes["aria-sort"], |
| 485 | headerAriaLabel: string | undefined; |
| 486 | |
| 487 | if (sortEnabled || onHeaderClick) { |
| 488 | // If this is a sortable header, clicking it should update the table data's sorting. |
| 489 | const isFirstTimeSort = sortBy !== dataKey; |
| 490 | |
| 491 | // If this is the firstTime sort of this column, use the column default sort order. |
| 492 | // Otherwise, invert the direction of the sort. |
| 493 | const newSortDirection = isFirstTimeSort |
| 494 | ? defaultSortDirection |
| 495 | : sortDirection === SortDirection.DESC |
| 496 | ? SortDirection.ASC |
nothing calls this directly
no test coverage detected