Permalink
Browse files

Performance optimizations. Version 1.1.38

  • Loading branch information...
energydrink9 committed Sep 6, 2018
1 parent e56b492 commit 594b2d3aad3acacd9f700da396404e26f596b8fd
@@ -1,5 +1,5 @@
// flow-typed signature: a88f637fa3ead7a42fea745573b18894
// flow-typed version: <<STUB>>/react-datepicker_v1.2.2/flow_v0.67.1
// flow-typed signature: be6f87d0cc771d4fa58651e16f97216d
// flow-typed version: <<STUB>>/react-datepicker_v1.5.0/flow_v0.80.0
/**
* This is an autogenerated libdef stub for:
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "functional-data-grid",
"version": "1.1.37",
"version": "1.1.38",
"description": "Functional Data Grid",
"main": "dist/FunctionalDataGrid.js",
"author": "Michele Lugano <michele.lugano9@gmail.com> (https://www.linkedin.com/in/mlugano/)",
@@ -37,11 +37,11 @@
"eslint": "4.15.0",
"eslint-config-react": "1.1.7",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.46.1",
"eslint-plugin-flowtype": "2.50.0",
"eslint-plugin-react": "7.5.1",
"file-loader": "1.1.6",
"flow-bin": "0.67.1",
"flow-typed": "2.3.0",
"flow-bin": "0.80.0",
"flow-typed": "2.5.1",
"graceful-fs": "4.1.11",
"json-loader": "0.5.7",
"postcss-flexbugs-fixes": "3.2.0",
View
@@ -16,7 +16,7 @@ type CellState = {
hover : boolean
}
export default class Cell extends React.Component<CellProps, CellState> {
export default class Cell extends React.PureComponent<CellProps, CellState> {
props : CellProps
state : CellState
@@ -40,7 +40,7 @@ export default class Cell extends React.Component<CellProps, CellState> {
renderValue = (c : BaseColumn, e : DataRow<any>) => e.type === 'aggregate'
? c.aggregateValueGetter == null ? <span/> : c.aggregateRenderer(c.aggregateValueGetter(e.content.content, e.content.key), e.content, this.props.rowIndex, e.originalIndex, this.props.rowHover, this.state.hover)
: c.valueGetter == null ? <span/> : c.renderer(c.valueGetter(e.content, e.type), e.content, this.props.rowIndex, e.originalIndex, this.props.rowHover, this.state.hover)
: c.valueGetter == null ? <span/> : c.renderer(c.valueGetter(e.content), e.content, this.props.rowIndex, e.originalIndex, this.props.rowHover, this.state.hover)
getCellStyle = () => {
let styles : Object = {
View
@@ -9,7 +9,7 @@ type CheckBoxFilterState = {
value : string
}
export default class CheckBoxFilter extends React.Component<CheckBoxFilterProps, CheckBoxFilterState> {
export default class CheckBoxFilter extends React.PureComponent<CheckBoxFilterProps, CheckBoxFilterState> {
props: CheckBoxFilterProps
state: CheckBoxFilterState
@@ -11,7 +11,7 @@ type ColumnsVisibilityMenuPropsType = {
onColumnVisibilityChange: Function
}
export default class ColumnsVisibilityMenu extends React.Component<ColumnsVisibilityMenuPropsType> {
export default class ColumnsVisibilityMenu extends React.PureComponent<ColumnsVisibilityMenuPropsType> {
props: ColumnsVisibilityMenuPropsType
View
@@ -24,7 +24,7 @@ const style = {
color: '#000'
}
class CustomInput extends React.Component<Object> {
class CustomInput extends React.PureComponent<Object> {
props: Object
render = () =>
@@ -39,10 +39,11 @@ export default class DatePickerFilter extends React.Component<DatePickerFilterPr
container = ({children} : any) => {
const el = document.body
return ReactDOM.createPortal(
children,
el
)
if (el != null)
return ReactDOM.createPortal(
children,
el
)
}
constructor(props : Object) {
View
@@ -10,7 +10,7 @@ type FooterProps<T> = {
totalElements : number
}
export default class Footer<T> extends React.Component<FooterProps<T>> {
export default class Footer<T> extends React.PureComponent<FooterProps<T>> {
render = () => {
let style={ backgroundColor: '#eee', textAlign: 'right', fontStyle: 'italic', lineHeight: defaultFooterHeight + 'px', height: defaultFooterHeight + 'px', flexShrink: 0, flexGrow: 0, padding: '2px 10px' }
@@ -56,7 +56,7 @@ type FunctionalDataGridState<T> = {
columnsVisibility: Map<string, boolean>
}
export default class FunctionalDataGrid<T, A: void> extends React.Component<FunctionalDataGridProps<T, A>, FunctionalDataGridState<T>> {
export default class FunctionalDataGrid<T, A: void> extends React.PureComponent<FunctionalDataGridProps<T, A>, FunctionalDataGridState<T>> {
props: FunctionalDataGridProps<T, A>;
state : FunctionalDataGridState<T>
@@ -191,7 +191,7 @@ export default class FunctionalDataGrid<T, A: void> extends React.Component<Func
applySort = (data : List<DataRow<T>>, sort : Sort): List<DataRow<T>> => {
let column = this.getColumnById(sort.columnId)
return data.sortBy((e: DataRow<T>) => column.valueGetter(e.content, e.type), (a, b) => (sort.direction === 'asc' ? 1 : -1) * column.comparator(a, b))
return data.sortBy((e: DataRow<T>) => column.valueGetter(e.content), (a, b) => (sort.direction === 'asc' ? 1 : -1) * column.comparator(a, b))
}
getColumnById = (columnId : string) => {
View
@@ -31,7 +31,7 @@ type HeaderState = {
const columnsOptionsWidth = 26
export default class Header extends React.Component<HeaderProps, HeaderState> {
export default class Header extends React.PureComponent<HeaderProps, HeaderState> {
props: HeaderProps
state: HeaderState
@@ -49,8 +49,9 @@ export default class Header extends React.Component<HeaderProps, HeaderState> {
this.updateScroll()
}
componentDidUpdate = () => {
this.updateScroll()
componentDidUpdate = (prevProps: HeaderProps) => {
if (this.props.scrollLeft !== prevProps.scrollLeft)
this.updateScroll()
}
updateScroll = () => {
View
@@ -17,7 +17,7 @@ type HeaderColumnState = {
hover: boolean
}
export default class HeaderColumn extends React.Component<HeaderColumnProps, HeaderColumnState> {
export default class HeaderColumn extends React.PureComponent<HeaderColumnProps, HeaderColumnState> {
static defaultProps = {
direction: 'none'
@@ -11,7 +11,7 @@ type HeaderColumnResizerState = {
hover: boolean
}
export default class HeaderColumnResizer extends React.Component<HeaderColumnResizerProps, HeaderColumnResizerState> {
export default class HeaderColumnResizer extends React.PureComponent<HeaderColumnResizerProps, HeaderColumnResizerState> {
props: HeaderColumnResizerProps
state: HeaderColumnResizerState
View
@@ -15,7 +15,7 @@ type HorizontalScrollbarProps = {
enableColumnsVisibilityMenu: boolean
}
export default class HorizontalScrollbar extends React.Component<HorizontalScrollbarProps> {
export default class HorizontalScrollbar extends React.PureComponent<HorizontalScrollbarProps> {
props: HorizontalScrollbarProps
@@ -29,8 +29,9 @@ export default class HorizontalScrollbar extends React.Component<HorizontalScrol
this.updateScroll()
}
componentDidUpdate = () => {
this.updateScroll()
componentDidUpdate = (prevProps: HorizontalScrollbarProps) => {
if (this.props.scrollLeft !== prevProps.scrollLeft)
this.updateScroll()
}
updateScroll = () => {
@@ -73,9 +74,17 @@ export default class HorizontalScrollbar extends React.Component<HorizontalScrol
</div>
</div>
getColumnWidth = (c : BaseColumn) => this.props.columnsWidth.get(c.id) != null ? this.props.columnsWidth.get(c.id) : c.width
getColumnWidth = (c : BaseColumn) : number => {
let columnWidth = this.props.columnsWidth.get(c.id)
return columnWidth != null
? columnWidth
: c.width != null
? c.width
: 100
}
renderColumn = (c : BaseColumn) => <div key={c.id} style={{width: this.getColumnWidth(c) + 'px', flexShrink: 0, minHeight: '1px'}} />
renderColumn = (c : BaseColumn) => <div key={c.id} style={{width: `${this.getColumnWidth(c)}px`, flexShrink: 0, minHeight: '1px'}} />
isColumnVisible = (columnId: string) => this.props.columnsVisibility.get(columnId)
}
}
View
@@ -21,14 +21,14 @@ type RowProps = {
columnsWidth : Map<string, number>,
columnsVisibility: Map<string, boolean>,
enableColumnsVisibilityMenu: boolean,
groups: List<Group>
groups: List<Group<any, any>>
}
type RowState = {
hover: boolean
}
export default class Row extends React.Component<RowProps, RowState> {
export default class Row extends React.PureComponent<RowProps, RowState> {
props: RowProps
state: RowState
@@ -46,8 +46,9 @@ export default class Row extends React.Component<RowProps, RowState> {
this.updateScroll()
}
componentDidUpdate = () => {
this.updateScroll()
componentDidUpdate = (prevProps: RowProps) => {
if (this.props.scrollLeft !== prevProps.scrollLeft)
this.updateScroll()
}
updateScroll = () => {
View
@@ -11,7 +11,7 @@ type SelectFilterState = {
value : ?any
}
export default class SelectFilter extends React.Component<SelectFilterProps, SelectFilterState> {
export default class SelectFilter extends React.PureComponent<SelectFilterProps, SelectFilterState> {
props: SelectFilterProps
state: SelectFilterState
View
@@ -9,7 +9,7 @@ type TextBoxFilterState = {
value : string
}
export default class TextBoxFilter extends React.Component<TextBoxFilterProps, TextBoxFilterState> {
export default class TextBoxFilter extends React.PureComponent<TextBoxFilterProps, TextBoxFilterState> {
props: TextBoxFilterProps
state: TextBoxFilterState

0 comments on commit 594b2d3

Please sign in to comment.