-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove remaining deprecated props #2073
Changes from all commits
3b2a9cf
431ffdc
c87e13e
4ac77f9
0865ead
37bb7c3
49efa29
6c479c4
fe823d3
758e7c6
4e1cf6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,11 +121,11 @@ export class Documentation extends React.PureComponent<IDocumentationProps, IDoc | |
<div className={classNames("docs-root", { "docs-examples-only": examplesOnly }, this.props.className)}> | ||
<div className="docs-app"> | ||
<div className="pt-navbar docs-navbar docs-flex-row"> | ||
<div className="pt-navbar-group">{this.props.navbarLeft}</div> | ||
<div className="pt-navbar-group pt-navbar-group-left">{this.props.navbarLeft}</div> | ||
<div className="pt-navbar-group"> | ||
<Navigator items={nav} onNavigate={this.handleNavigation} /> | ||
</div> | ||
<div className="pt-navbar-group">{this.props.navbarRight}</div> | ||
<div className="pt-navbar-group pt-navbar-group-right">{this.props.navbarRight}</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have components for |
||
</div> | ||
<div className="docs-nav" ref={this.refHandlers.nav}> | ||
<NavMenu | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright 2018 Palantir Technologies, Inc. All rights reserved. | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import * as PropTypes from "prop-types"; | ||
import * as React from "react"; | ||
|
||
export interface IColumnInteractionBarContextTypes { | ||
enableColumnInteractionBar: boolean; | ||
} | ||
|
||
export const columnInteractionBarContextTypes: React.ValidationMap<IColumnInteractionBarContextTypes> = { | ||
enableColumnInteractionBar: PropTypes.bool, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,7 @@ | |
*/ | ||
|
||
const ns = "[Blueprint Table]"; | ||
const deprec = `${ns} DEPRECATION:`; | ||
|
||
export const COLUMN_HEADER_CELL_MENU_DEPRECATED = | ||
deprec + ` <ColumnHeaderCell> menu is deprecated. Use menuRenderer instead.`; | ||
export const COLUMN_HEADER_CELL_USE_INTERACTION_BAR_DEPRECATED = | ||
deprec + | ||
` <ColumnHeaderCell> enableColumnInteractionBar is deprecated. Pass the prop to the top-level <Table> instead. When you pass the prop to <Table>, that value will override the one provided directly to <ColumnHeaderCell>.`; | ||
|
||
export const ROW_HEADER_CELL_MENU_DEPRECATED = | ||
deprec + ` <RowHeaderCell> menu is deprecated. Use menuRenderer instead.`; | ||
// const deprec = `${ns} DEPRECATION:`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commented code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eh, sort of on purpose. will be useful as a reminder for future deprecation messages 🤷♂️ |
||
|
||
export const QUADRANT_ON_SCROLL_UNNECESSARILY_DEFINED = | ||
ns + ` <TableQuadrant> onScroll need not be defined for any quadrant aside from the MAIN quadrant.`; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,24 +18,11 @@ import { | |
} from "@blueprintjs/core"; | ||
|
||
import * as Classes from "../common/classes"; | ||
import * as Errors from "../common/errors"; | ||
import { columnInteractionBarContextTypes, IColumnInteractionBarContextTypes } from "../common/context"; | ||
import { LoadableContent } from "../common/loadableContent"; | ||
import { HeaderCell, IHeaderCellProps } from "./headerCell"; | ||
|
||
export interface IColumnNameProps { | ||
/** | ||
* If `true`, adds an interaction bar on top of the column header cell and | ||
* moves the menu and selection interactions to it. | ||
* | ||
* This allows you to override the rendering of column name without worry of | ||
* clobbering the menu or other interactions. | ||
* | ||
* @default false | ||
* @deprecated since blueprintjs/table v1.27.0; pass this prop to `Table` | ||
* instead. | ||
*/ | ||
enableColumnInteractionBar?: boolean; | ||
|
||
/** | ||
* The name displayed in the header of the column. | ||
*/ | ||
|
@@ -49,7 +36,7 @@ export interface IColumnNameProps { | |
* `EditableName` component for editing column names. | ||
* | ||
* If you define this callback, we recommend you also set | ||
* `enableColumnInteractionBar` to `true`, to avoid issues with menus or selection. | ||
* `<Table enableColumnInteractionBar={true}>` to avoid issues with menus or selection. | ||
* | ||
* The callback will also receive the column index if an `index` was originally | ||
* provided via props. | ||
|
@@ -85,11 +72,14 @@ export function HorizontalCellDivider(): JSX.Element { | |
|
||
export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellProps, IColumnHeaderCellState> { | ||
public static defaultProps: IColumnHeaderCellProps = { | ||
enableColumnInteractionBar: false, | ||
isActive: false, | ||
menuIconName: "chevron-down", | ||
}; | ||
|
||
public static contextTypes: React.ValidationMap< | ||
IColumnInteractionBarContextTypes | ||
> = columnInteractionBarContextTypes; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you do need it. there's a whole "typescript cannot name this type even though it knows where it comes from" rabbit hole which I won't bother explaining here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dang i gotcha |
||
|
||
/** | ||
* This method determines if a `MouseEvent` was triggered on a target that | ||
* should be used as the header click/drag target. This enables users of | ||
|
@@ -106,6 +96,7 @@ export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellPro | |
); | ||
} | ||
|
||
public context: IColumnInteractionBarContextTypes; | ||
public state = { | ||
isActive: false, | ||
}; | ||
|
@@ -120,14 +111,13 @@ export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellPro | |
// from IColumnNameProps | ||
name, | ||
nameRenderer, | ||
enableColumnInteractionBar, | ||
|
||
// from IHeaderProps | ||
...spreadableProps | ||
} = this.props; | ||
|
||
const classes = classNames(spreadableProps.className, Classes.TABLE_COLUMN_HEADER_CELL, { | ||
[Classes.TABLE_HAS_INTERACTION_BAR]: enableColumnInteractionBar, | ||
[Classes.TABLE_HAS_INTERACTION_BAR]: this.context.enableColumnInteractionBar, | ||
[Classes.TABLE_HAS_REORDER_HANDLE]: this.props.reorderHandle != null, | ||
}); | ||
|
||
|
@@ -145,17 +135,8 @@ export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellPro | |
); | ||
} | ||
|
||
protected validateProps(nextProps: IColumnHeaderCellProps) { | ||
if (nextProps.menu != null) { | ||
// throw this warning from the publicly exported, higher-order *HeaderCell components | ||
// rather than HeaderCell, so consumers know exactly which components are receiving the | ||
// offending prop | ||
console.warn(Errors.COLUMN_HEADER_CELL_MENU_DEPRECATED); | ||
} | ||
} | ||
|
||
private renderName() { | ||
const { index, loading, name, nameRenderer, reorderHandle, enableColumnInteractionBar } = this.props; | ||
const { index, loading, name, nameRenderer, reorderHandle } = this.props; | ||
|
||
const dropdownMenu = this.maybeRenderDropdownMenu(); | ||
const defaultName = <div className={Classes.TABLE_TRUNCATED_TEXT}>{name}</div>; | ||
|
@@ -168,7 +149,7 @@ export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellPro | |
</LoadableContent> | ||
); | ||
|
||
if (enableColumnInteractionBar) { | ||
if (this.context.enableColumnInteractionBar) { | ||
return ( | ||
<div className={Classes.TABLE_COLUMN_NAME} title={name}> | ||
<div className={Classes.TABLE_INTERACTION_BAR}> | ||
|
@@ -199,24 +180,21 @@ export class ColumnHeaderCell extends AbstractPureComponent<IColumnHeaderCellPro | |
} | ||
|
||
private maybeRenderDropdownMenu() { | ||
const { index, menu, menuIconName, menuRenderer } = this.props; | ||
const { index, menuIconName, menuRenderer } = this.props; | ||
|
||
if (menuRenderer == null && menu == null) { | ||
if (!CoreUtils.isFunction(menuRenderer)) { | ||
return undefined; | ||
} | ||
|
||
const classes = classNames(Classes.TABLE_TH_MENU_CONTAINER, { | ||
[Classes.TABLE_TH_MENU_OPEN]: this.state.isActive, | ||
}); | ||
|
||
// prefer menuRenderer if it's defined | ||
const content = CoreUtils.isFunction(menuRenderer) ? menuRenderer(index) : menu; | ||
|
||
return ( | ||
<div className={classes}> | ||
<div className={Classes.TABLE_TH_MENU_CONTAINER_BACKGROUND} /> | ||
<Popover | ||
content={content} | ||
content={menuRenderer(index)} | ||
position={Position.BOTTOM} | ||
className={Classes.TABLE_TH_MENU} | ||
modifiers={{ preventOverflow: { boundariesElement: "window" } }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌