ipppm-pivot
Advanced tools
Comparing version 6.9.8 to 6.9.9
{ | ||
"name": "ipppm-pivot", | ||
"version": "6.9.8", | ||
"version": "6.9.9", | ||
"description": "A fast, lightweight, opinionated table and datagrid built on React", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
392
src/index.js
@@ -1032,10 +1032,10 @@ import React, { Component } from 'react' | ||
? _.normalizeComponent( | ||
ResolvedFilterComponent, | ||
{ | ||
column, | ||
filter, | ||
onChange: value => this.filterColumn(column, value), | ||
}, | ||
defaultProps.column.Filter | ||
) | ||
ResolvedFilterComponent, | ||
{ | ||
column, | ||
filter, | ||
onChange: value => this.filterColumn(column, value), | ||
}, | ||
defaultProps.column.Filter | ||
) | ||
: null} | ||
@@ -1205,3 +1205,3 @@ </ThComponent> | ||
); | ||
// }); | ||
// }); | ||
@@ -1248,180 +1248,180 @@ // return React.createElement( | ||
{/*{allVisibleColumns.map((column, i2) => {*/} | ||
{/*const resizedCol = resized.find(x => x.id === column.id) || {}*/} | ||
{/*const show = typeof column.show === 'function' ? column.show() : column.show*/} | ||
{/*const width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth)*/} | ||
{/*const maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth)*/} | ||
{/*const tdProps = _.splitProps(getTdProps(finalState, rowInfo, column, this))*/} | ||
{/*const columnProps = _.splitProps(column.getProps(finalState, rowInfo, column, this))*/} | ||
{/*const resizedCol = resized.find(x => x.id === column.id) || {}*/} | ||
{/*const show = typeof column.show === 'function' ? column.show() : column.show*/} | ||
{/*const width = _.getFirstDefined(resizedCol.value, column.width, column.minWidth)*/} | ||
{/*const maxWidth = _.getFirstDefined(resizedCol.value, column.width, column.maxWidth)*/} | ||
{/*const tdProps = _.splitProps(getTdProps(finalState, rowInfo, column, this))*/} | ||
{/*const columnProps = _.splitProps(column.getProps(finalState, rowInfo, column, this))*/} | ||
{/*const classes = [tdProps.className, column.className, columnProps.className]*/} | ||
{/*const classes = [tdProps.className, column.className, columnProps.className]*/} | ||
{/*const styles = {*/} | ||
{/*...tdProps.style,*/} | ||
{/*...column.style,*/} | ||
{/*...columnProps.style,*/} | ||
{/*}*/} | ||
{/*const styles = {*/} | ||
{/*...tdProps.style,*/} | ||
{/*...column.style,*/} | ||
{/*...columnProps.style,*/} | ||
{/*}*/} | ||
{/*const cellInfo = {*/} | ||
{/*...rowInfo,*/} | ||
{/*isExpanded,*/} | ||
{/*column: { ...column },*/} | ||
{/*value: rowInfo.row[column.id],*/} | ||
{/*pivoted: column.pivoted,*/} | ||
{/*expander: column.expander,*/} | ||
{/*resized,*/} | ||
{/*show,*/} | ||
{/*width,*/} | ||
{/*maxWidth,*/} | ||
{/*tdProps,*/} | ||
{/*columnProps,*/} | ||
{/*classes,*/} | ||
{/*styles,*/} | ||
{/*}*/} | ||
{/*const cellInfo = {*/} | ||
{/*...rowInfo,*/} | ||
{/*isExpanded,*/} | ||
{/*column: { ...column },*/} | ||
{/*value: rowInfo.row[column.id],*/} | ||
{/*pivoted: column.pivoted,*/} | ||
{/*expander: column.expander,*/} | ||
{/*resized,*/} | ||
{/*show,*/} | ||
{/*width,*/} | ||
{/*maxWidth,*/} | ||
{/*tdProps,*/} | ||
{/*columnProps,*/} | ||
{/*classes,*/} | ||
{/*styles,*/} | ||
{/*}*/} | ||
{/*const value = cellInfo.value*/} | ||
{/*const value = cellInfo.value*/} | ||
{/*let useOnExpanderClick*/} | ||
{/*let isBranch*/} | ||
{/*let isPreview*/} | ||
{/*let useOnExpanderClick*/} | ||
{/*let isBranch*/} | ||
{/*let isPreview*/} | ||
{/*const onExpanderClick = e => {*/} | ||
{/*let newExpanded = _.clone(expanded)*/} | ||
{/*if (isExpanded) {*/} | ||
{/*newExpanded = _.set(newExpanded, cellInfo.nestingPath, false)*/} | ||
{/*} else {*/} | ||
{/*newExpanded = _.set(newExpanded, cellInfo.nestingPath, {})*/} | ||
{/*}*/} | ||
{/*const onExpanderClick = e => {*/} | ||
{/*let newExpanded = _.clone(expanded)*/} | ||
{/*if (isExpanded) {*/} | ||
{/*newExpanded = _.set(newExpanded, cellInfo.nestingPath, false)*/} | ||
{/*} else {*/} | ||
{/*newExpanded = _.set(newExpanded, cellInfo.nestingPath, {})*/} | ||
{/*}*/} | ||
{/*return this.setStateWithData(*/} | ||
{/*{*/} | ||
{/*expanded: newExpanded,*/} | ||
{/*},*/} | ||
{/*() => onExpandedChange && onExpandedChange(newExpanded, cellInfo.nestingPath, e)*/} | ||
{/*)*/} | ||
{/*}*/} | ||
{/*return this.setStateWithData(*/} | ||
{/*{*/} | ||
{/*expanded: newExpanded,*/} | ||
{/*},*/} | ||
{/*() => onExpandedChange && onExpandedChange(newExpanded, cellInfo.nestingPath, e)*/} | ||
{/*)*/} | ||
{/*}*/} | ||
{/*// Default to a standard cell*/} | ||
{/*let resolvedCell = _.normalizeComponent(column.Cell, cellInfo, value)*/} | ||
{/*//*/} | ||
{/*// // Resolve Renderers*/} | ||
{/*// const ResolvedAggregatedComponent =*/} | ||
{/*// column.Aggregated || (!column.aggregate ? AggregatedComponent : column.Cell)*/} | ||
{/*// const ResolvedExpanderComponent = column.Expander || ExpanderComponent*/} | ||
{/*// const ResolvedPivotValueComponent = column.PivotValue || PivotValueComponent*/} | ||
{/*// const DefaultResolvedPivotComponent =*/} | ||
{/*// PivotComponent ||*/} | ||
{/*// (props => (*/} | ||
{/*// <div>*/} | ||
{/*// <ResolvedExpanderComponent {...props} />*/} | ||
{/*// <ResolvedPivotValueComponent {...props} />*/} | ||
{/*// </div>*/} | ||
{/*// ))*/} | ||
{/*// const ResolvedPivotComponent = column.Pivot || DefaultResolvedPivotComponent*/} | ||
{/*//*/} | ||
{/*// // Is this cell expandable?*/} | ||
{/*// if (cellInfo.pivoted || cellInfo.expander) {*/} | ||
{/*// // Make it expandable by defualt*/} | ||
{/*// cellInfo.expandable = true*/} | ||
{/*// useOnExpanderClick = true*/} | ||
{/*// // If pivoted, has no subRows, and does not have a subComponent,*/} | ||
{/*// // do not make expandable*/} | ||
{/*// if (cellInfo.pivoted && !cellInfo.subRows && !SubComponent) {*/} | ||
{/*// cellInfo.expandable = false*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*// if (cellInfo.pivoted) {*/} | ||
{/*// // Is this column a branch?*/} | ||
{/*// isBranch = rowInfo.row[pivotIDKey] === column.id && cellInfo.subRows*/} | ||
{/*// // Should this column be blank?*/} | ||
{/*// isPreview =*/} | ||
{/*// pivotBy.indexOf(column.id) > pivotBy.indexOf(rowInfo.row[pivotIDKey]) &&*/} | ||
{/*// cellInfo.subRows*/} | ||
{/*// // Pivot Cell Render Override*/} | ||
{/*// if (isBranch) {*/} | ||
{/*// // isPivot*/} | ||
{/*// resolvedCell = _.normalizeComponent(*/} | ||
{/*// ResolvedPivotComponent,*/} | ||
{/*// {*/} | ||
{/*// ...cellInfo,*/} | ||
{/*// value: row[pivotValKey],*/} | ||
{/*// },*/} | ||
{/*// row[pivotValKey]*/} | ||
{/*// )*/} | ||
{/*// } else if (isPreview) {*/} | ||
{/*// // Show the pivot preview*/} | ||
{/*// resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value)*/} | ||
{/*// } else {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// } else if (cellInfo.aggregated) {*/} | ||
{/*// resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value)*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*// if (cellInfo.expander) {*/} | ||
{/*// resolvedCell = _.normalizeComponent(*/} | ||
{/*// ResolvedExpanderComponent,*/} | ||
{/*// cellInfo,*/} | ||
{/*// row[pivotValKey]*/} | ||
{/*// )*/} | ||
{/*// if (pivotBy) {*/} | ||
{/*// if (cellInfo.groupedByPivot) {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// if (!cellInfo.subRows && !SubComponent) {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*const resolvedOnExpanderClick = useOnExpanderClick ? onExpanderClick : () => {}*/} | ||
{/*//*/} | ||
{/*// // If there are multiple onClick events, make sure they don't*/} | ||
{/*// // override eachother. This should maybe be expanded to handle all*/} | ||
{/*// // function attributes*/} | ||
{/*const interactionProps = {*/} | ||
{/*onClick: resolvedOnExpanderClick,*/} | ||
{/*}*/} | ||
{/*// Default to a standard cell*/} | ||
{/*let resolvedCell = _.normalizeComponent(column.Cell, cellInfo, value)*/} | ||
{/*//*/} | ||
{/*// // Resolve Renderers*/} | ||
{/*// const ResolvedAggregatedComponent =*/} | ||
{/*// column.Aggregated || (!column.aggregate ? AggregatedComponent : column.Cell)*/} | ||
{/*// const ResolvedExpanderComponent = column.Expander || ExpanderComponent*/} | ||
{/*// const ResolvedPivotValueComponent = column.PivotValue || PivotValueComponent*/} | ||
{/*// const DefaultResolvedPivotComponent =*/} | ||
{/*// PivotComponent ||*/} | ||
{/*// (props => (*/} | ||
{/*// <div>*/} | ||
{/*// <ResolvedExpanderComponent {...props} />*/} | ||
{/*// <ResolvedPivotValueComponent {...props} />*/} | ||
{/*// </div>*/} | ||
{/*// ))*/} | ||
{/*// const ResolvedPivotComponent = column.Pivot || DefaultResolvedPivotComponent*/} | ||
{/*//*/} | ||
{/*// // Is this cell expandable?*/} | ||
{/*// if (cellInfo.pivoted || cellInfo.expander) {*/} | ||
{/*// // Make it expandable by defualt*/} | ||
{/*// cellInfo.expandable = true*/} | ||
{/*// useOnExpanderClick = true*/} | ||
{/*// // If pivoted, has no subRows, and does not have a subComponent,*/} | ||
{/*// // do not make expandable*/} | ||
{/*// if (cellInfo.pivoted && !cellInfo.subRows && !SubComponent) {*/} | ||
{/*// cellInfo.expandable = false*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*// if (cellInfo.pivoted) {*/} | ||
{/*// // Is this column a branch?*/} | ||
{/*// isBranch = rowInfo.row[pivotIDKey] === column.id && cellInfo.subRows*/} | ||
{/*// // Should this column be blank?*/} | ||
{/*// isPreview =*/} | ||
{/*// pivotBy.indexOf(column.id) > pivotBy.indexOf(rowInfo.row[pivotIDKey]) &&*/} | ||
{/*// cellInfo.subRows*/} | ||
{/*// // Pivot Cell Render Override*/} | ||
{/*// if (isBranch) {*/} | ||
{/*// // isPivot*/} | ||
{/*// resolvedCell = _.normalizeComponent(*/} | ||
{/*// ResolvedPivotComponent,*/} | ||
{/*// {*/} | ||
{/*// ...cellInfo,*/} | ||
{/*// value: row[pivotValKey],*/} | ||
{/*// },*/} | ||
{/*// row[pivotValKey]*/} | ||
{/*// )*/} | ||
{/*// } else if (isPreview) {*/} | ||
{/*// // Show the pivot preview*/} | ||
{/*// resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value)*/} | ||
{/*// } else {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// } else if (cellInfo.aggregated) {*/} | ||
{/*// resolvedCell = _.normalizeComponent(ResolvedAggregatedComponent, cellInfo, value)*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*// if (cellInfo.expander) {*/} | ||
{/*// resolvedCell = _.normalizeComponent(*/} | ||
{/*// ResolvedExpanderComponent,*/} | ||
{/*// cellInfo,*/} | ||
{/*// row[pivotValKey]*/} | ||
{/*// )*/} | ||
{/*// if (pivotBy) {*/} | ||
{/*// if (cellInfo.groupedByPivot) {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// if (!cellInfo.subRows && !SubComponent) {*/} | ||
{/*// resolvedCell = null*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*// }*/} | ||
{/*//*/} | ||
{/*const resolvedOnExpanderClick = useOnExpanderClick ? onExpanderClick : () => {}*/} | ||
{/*//*/} | ||
{/*// // If there are multiple onClick events, make sure they don't*/} | ||
{/*// // override eachother. This should maybe be expanded to handle all*/} | ||
{/*// // function attributes*/} | ||
{/*const interactionProps = {*/} | ||
{/*onClick: resolvedOnExpanderClick,*/} | ||
{/*}*/} | ||
{/*if (tdProps.rest.onClick) {*/} | ||
{/*interactionProps.onClick = e => {*/} | ||
{/*tdProps.rest.onClick(e, () => resolvedOnExpanderClick(e))*/} | ||
{/*}*/} | ||
{/*}*/} | ||
{/*if (tdProps.rest.onClick) {*/} | ||
{/*interactionProps.onClick = e => {*/} | ||
{/*tdProps.rest.onClick(e, () => resolvedOnExpanderClick(e))*/} | ||
{/*}*/} | ||
{/*}*/} | ||
{/*if (columnProps.rest.onClick) {*/} | ||
{/*interactionProps.onClick = e => {*/} | ||
{/*columnProps.rest.onClick(e, () => resolvedOnExpanderClick(e))*/} | ||
{/*}*/} | ||
{/*}*/} | ||
{/*if (columnProps.rest.onClick) {*/} | ||
{/*interactionProps.onClick = e => {*/} | ||
{/*columnProps.rest.onClick(e, () => resolvedOnExpanderClick(e))*/} | ||
{/*}*/} | ||
{/*}*/} | ||
{/*// Return the cell*/} | ||
{/*return (*/} | ||
{/*<TdComponent*/} | ||
{/*// eslint-disable-next-line react/no-array-index-key*/} | ||
{/*key={`${i2}-${column.id}`}*/} | ||
{/*className={classnames(*/} | ||
{/*classes,*/} | ||
{/*!show && 'hidden',*/} | ||
{/*cellInfo.expandable && 'rt-expandable',*/} | ||
{/*(isBranch || isPreview) && 'rt-pivot'*/} | ||
{/*)}*/} | ||
{/*style={{*/} | ||
{/*...styles,*/} | ||
{/*flex: `${width} 0 auto`,*/} | ||
{/*width: _.asPx(width),*/} | ||
{/*maxWidth: _.asPx(maxWidth),*/} | ||
{/*}}*/} | ||
{/*{...tdProps.rest}*/} | ||
{/*{...columnProps.rest}*/} | ||
{/*{...interactionProps}*/} | ||
{/*>*/} | ||
{/*{resolvedCell}*/} | ||
{/*</TdComponent>*/} | ||
{/*)*/} | ||
{/*// Return the cell*/} | ||
{/*return (*/} | ||
{/*<TdComponent*/} | ||
{/*// eslint-disable-next-line react/no-array-index-key*/} | ||
{/*key={`${i2}-${column.id}`}*/} | ||
{/*className={classnames(*/} | ||
{/*classes,*/} | ||
{/*!show && 'hidden',*/} | ||
{/*cellInfo.expandable && 'rt-expandable',*/} | ||
{/*(isBranch || isPreview) && 'rt-pivot'*/} | ||
{/*)}*/} | ||
{/*style={{*/} | ||
{/*...styles,*/} | ||
{/*flex: `${width} 0 auto`,*/} | ||
{/*width: _.asPx(width),*/} | ||
{/*maxWidth: _.asPx(maxWidth),*/} | ||
{/*}}*/} | ||
{/*{...tdProps.rest}*/} | ||
{/*{...columnProps.rest}*/} | ||
{/*{...interactionProps}*/} | ||
{/*>*/} | ||
{/*{resolvedCell}*/} | ||
{/*</TdComponent>*/} | ||
{/*)*/} | ||
{/*})}*/} | ||
</TrComponent> | ||
{rowInfo.subRows && | ||
isExpanded && | ||
rowInfo.subRows.map((d, i) => makePageRow(d, i, rowInfo.nestingPath))} | ||
isExpanded && | ||
rowInfo.subRows.map((d, i) => makePageRow(d, i, rowInfo.nestingPath))} | ||
{SubComponent && !rowInfo.subRows && isExpanded && SubComponent(rowInfo)} | ||
@@ -1598,3 +1598,4 @@ </TrGroupComponent> | ||
const tHeaderHeight = headerRowCount ? headerRowCount * rowHeight: countHeaders * rowHeight + rowHeight; | ||
const spaceForBody = height - tHeaderHeight - tFootHeight - scrollBarWidth; | ||
let spaceForBody = height - tHeaderHeight - tFootHeight - scrollBarWidth; | ||
spaceForBody = pageRows.length * rowHeight > spaceForBody ? spaceForBody : pageRows.length * rowHeight; | ||
const { paddingBottom, pageSize } = calculateItemsPerPage(spaceForBody); | ||
@@ -1675,23 +1676,23 @@ const tBodyHeight = spaceForBody - paddingBottom | ||
{...tBodyProps.rest}> | ||
<MultiGrid | ||
ref={this.setGrid} | ||
className={classnames('DisableScroll')} | ||
classNameBottomRightGrid={classnames('DisableScroll')} | ||
classNameBottomLeftGrid={classnames('DisableScroll')} | ||
cellRenderer={cellRenderer} | ||
columnCount={allVisibleColumns.length} | ||
fixedColumnCount={fixedColumnCount} | ||
columnWidth={getWidth} | ||
scrollLeft={scrollLeft} | ||
overscanColumnCount={0} | ||
overscanRowCount={2} | ||
rowHeight={rowHeight} | ||
rowCount={itemsOnPage} | ||
width={width} | ||
height={this._bodyHeight} | ||
enableFixedColumnScroll | ||
enableFixedRowScroll | ||
hideTopRightGridScrollbar | ||
hideBottomLeftGridScrollbar | ||
/> | ||
<MultiGrid | ||
ref={this.setGrid} | ||
className={classnames('DisableScroll')} | ||
classNameBottomRightGrid={classnames('DisableScroll')} | ||
classNameBottomLeftGrid={classnames('DisableScroll')} | ||
cellRenderer={cellRenderer} | ||
columnCount={allVisibleColumns.length} | ||
fixedColumnCount={fixedColumnCount} | ||
columnWidth={getWidth} | ||
scrollLeft={scrollLeft} | ||
overscanColumnCount={0} | ||
overscanRowCount={2} | ||
rowHeight={rowHeight} | ||
rowCount={itemsOnPage} | ||
width={width} | ||
height={this._bodyHeight} | ||
enableFixedColumnScroll | ||
enableFixedRowScroll | ||
hideTopRightGridScrollbar | ||
hideBottomLeftGridScrollbar | ||
/> | ||
@@ -1736,2 +1737,3 @@ | ||
<div | ||
data-html2canvas-ignore | ||
style={{ | ||
@@ -1738,0 +1740,0 @@ order: 2, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
35704
2659083