Introduce createTablePlugin
Summary: This diff exposes the createTablePlugin from flipper-plugin, so that createTablePlugin based plugins can be converted to Sandy as well Reviewed By: jknoxville Differential Revision: D28031227 fbshipit-source-id: 8e9c82da08a83fddab740b46be9917b6a1023117
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cf2405a466
commit
05bf55419f
@@ -19,6 +19,7 @@ import React from 'react';
|
||||
import {tryGetFlipperLibImplementation} from '../../plugin/FlipperLib';
|
||||
import {DataTableColumn} from './DataTable';
|
||||
import {DataSource} from '../../state/DataSource';
|
||||
import {toFirstUpper} from '../../utils/toFirstUpper';
|
||||
|
||||
const {Item, SubMenu} = Menu;
|
||||
|
||||
@@ -137,5 +138,5 @@ export function tableContextMenuFactory<T>(
|
||||
|
||||
function friendlyColumnTitle(column: DataTableColumn<any>): string {
|
||||
const name = column.title || column.key;
|
||||
return name[0].toUpperCase() + name.substr(1);
|
||||
return toFirstUpper(name);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import {CaretDownFilled, CaretUpFilled} from '@ant-design/icons';
|
||||
import {Layout} from '../Layout';
|
||||
import {Sorting, SortDirection, DataTableDispatch} from './DataTableManager';
|
||||
import {FilterButton, FilterIcon} from './ColumnFilter';
|
||||
import {toFirstUpper} from '../../utils/toFirstUpper';
|
||||
|
||||
const {Text} = Typography;
|
||||
|
||||
@@ -187,7 +188,13 @@ function TableHeadColumn({
|
||||
role="button"
|
||||
tabIndex={0}>
|
||||
<Text type="secondary">
|
||||
{column.title ?? <> </>}
|
||||
{column.title === undefined ? (
|
||||
toFirstUpper(column.key)
|
||||
) : column.title === '' ? (
|
||||
<> </>
|
||||
) : (
|
||||
column.title
|
||||
)}
|
||||
<SortIcons
|
||||
direction={sorted}
|
||||
onSort={(dir) =>
|
||||
|
||||
Reference in New Issue
Block a user