test filtrar datos segun valuefilter, remover console log
This commit is contained in:
parent
a293bf4b00
commit
b8af03c035
@ -70,7 +70,6 @@ var DraggableAttribute = exports.DraggableAttribute = function (_React$Component
|
|||||||
}, {
|
}, {
|
||||||
key: 'matchesFilter',
|
key: 'matchesFilter',
|
||||||
value: function matchesFilter(x) {
|
value: function matchesFilter(x) {
|
||||||
console.log(' matchesFilter x ', x);
|
|
||||||
return x.toLowerCase().trim().includes(this.state.filterText.toLowerCase().trim());
|
return x.toLowerCase().trim().includes(this.state.filterText.toLowerCase().trim());
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -357,15 +356,32 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'componentDidUpdate',
|
key: 'componentDidUpdate',
|
||||||
value: function componentDidUpdate() {
|
value: function componentDidUpdate() {
|
||||||
|
var _this6 = this;
|
||||||
|
|
||||||
console.log(' componentDidUpdate ');
|
console.log(' componentDidUpdate ');
|
||||||
var pivotData = new _Utilities.PivotData(this.props);
|
console.log(' componentDidUpdate this.props.data ', this.props.data);
|
||||||
console.log(' componentDidUpdate pivotData ', pivotData);
|
console.log(' componentDidUpdate state ', this.state);
|
||||||
|
var filteredData = this.props.data.filter(function (row) {
|
||||||
|
var _valuefilter = _this6.props.valueFilter;
|
||||||
|
if (typeof _valuefilter !== 'undefined' && _valuefilter !== null) {
|
||||||
|
var keysFilter = Object.keys(_valuefilter);
|
||||||
|
keysFilter.forEach(function (keyF) {
|
||||||
|
var valsFilter = Object.keys(_valuefilter[keyF]);
|
||||||
|
valsFilter.forEach(function (valF) {
|
||||||
|
if (row[keyF] === valF) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
console.log(' componentDidUpdate filteredData ', filteredData);
|
||||||
this.materializeInput(this.props.data);
|
this.materializeInput(this.props.data);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'materializeInput',
|
key: 'materializeInput',
|
||||||
value: function materializeInput(nextData) {
|
value: function materializeInput(nextData) {
|
||||||
console.log(' materializeInput nextData ', nextData);
|
|
||||||
if (this.state.data === nextData) {
|
if (this.state.data === nextData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -416,8 +432,6 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
}
|
}
|
||||||
recordsProcessed++;
|
recordsProcessed++;
|
||||||
});
|
});
|
||||||
console.log(' newState materializedInput ', newState.materializedInput);
|
|
||||||
console.log(' newState derivedAttributes ', this.props.derivedAttributes);
|
|
||||||
console.log(' newState attrValues ', newState.attrValues);
|
console.log(' newState attrValues ', newState.attrValues);
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
}
|
}
|
||||||
@ -429,10 +443,10 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'propUpdater',
|
key: 'propUpdater',
|
||||||
value: function propUpdater(key) {
|
value: function propUpdater(key) {
|
||||||
var _this6 = this;
|
var _this7 = this;
|
||||||
|
|
||||||
return function (value) {
|
return function (value) {
|
||||||
return _this6.sendPropUpdate(_defineProperty({}, key, { $set: value }));
|
return _this7.sendPropUpdate(_defineProperty({}, key, { $set: value }));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -487,7 +501,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'makeDnDCell',
|
key: 'makeDnDCell',
|
||||||
value: function makeDnDCell(items, onChange, classes) {
|
value: function makeDnDCell(items, onChange, classes) {
|
||||||
var _this7 = this;
|
var _this8 = this;
|
||||||
|
|
||||||
return _react2.default.createElement(
|
return _react2.default.createElement(
|
||||||
_reactSortablejs2.default,
|
_reactSortablejs2.default,
|
||||||
@ -506,15 +520,15 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
return _react2.default.createElement(DraggableAttribute, {
|
return _react2.default.createElement(DraggableAttribute, {
|
||||||
name: x,
|
name: x,
|
||||||
key: x,
|
key: x,
|
||||||
attrValues: _this7.state.attrValues[x],
|
attrValues: _this8.state.attrValues[x],
|
||||||
valueFilter: _this7.props.valueFilter[x] || {},
|
valueFilter: _this8.props.valueFilter[x] || {},
|
||||||
sorter: (0, _Utilities.getSort)(_this7.props.sorters, x),
|
sorter: (0, _Utilities.getSort)(_this8.props.sorters, x),
|
||||||
menuLimit: _this7.props.menuLimit,
|
menuLimit: _this8.props.menuLimit,
|
||||||
setValuesInFilter: _this7.setValuesInFilter.bind(_this7),
|
setValuesInFilter: _this8.setValuesInFilter.bind(_this8),
|
||||||
addValuesToFilter: _this7.addValuesToFilter.bind(_this7),
|
addValuesToFilter: _this8.addValuesToFilter.bind(_this8),
|
||||||
moveFilterBoxToTop: _this7.moveFilterBoxToTop.bind(_this7),
|
moveFilterBoxToTop: _this8.moveFilterBoxToTop.bind(_this8),
|
||||||
removeValuesFromFilter: _this7.removeValuesFromFilter.bind(_this7),
|
removeValuesFromFilter: _this8.removeValuesFromFilter.bind(_this8),
|
||||||
zIndex: _this7.state.zIndices[x] || _this7.state.maxZIndex
|
zIndex: _this8.state.zIndices[x] || _this8.state.maxZIndex
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -522,7 +536,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'render',
|
key: 'render',
|
||||||
value: function render() {
|
value: function render() {
|
||||||
var _this8 = this;
|
var _this9 = this;
|
||||||
|
|
||||||
var numValsAllowed = this.props.aggregators[this.props.aggregatorName]([])().numInputs || 0;
|
var numValsAllowed = this.props.aggregators[this.props.aggregatorName]([])().numInputs || 0;
|
||||||
|
|
||||||
@ -539,8 +553,8 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
open: this.isOpen('renderer'),
|
open: this.isOpen('renderer'),
|
||||||
zIndex: this.isOpen('renderer') ? this.state.maxZIndex + 1 : 1,
|
zIndex: this.isOpen('renderer') ? this.state.maxZIndex + 1 : 1,
|
||||||
toggle: function toggle() {
|
toggle: function toggle() {
|
||||||
return _this8.setState({
|
return _this9.setState({
|
||||||
openDropdown: _this8.isOpen('renderer') ? false : 'renderer'
|
openDropdown: _this9.isOpen('renderer') ? false : 'renderer'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setValue: this.propUpdater('rendererName')
|
setValue: this.propUpdater('rendererName')
|
||||||
@ -570,8 +584,8 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
open: this.isOpen('aggregators'),
|
open: this.isOpen('aggregators'),
|
||||||
zIndex: this.isOpen('aggregators') ? this.state.maxZIndex + 1 : 1,
|
zIndex: this.isOpen('aggregators') ? this.state.maxZIndex + 1 : 1,
|
||||||
toggle: function toggle() {
|
toggle: function toggle() {
|
||||||
return _this8.setState({
|
return _this9.setState({
|
||||||
openDropdown: _this8.isOpen('aggregators') ? false : 'aggregators'
|
openDropdown: _this9.isOpen('aggregators') ? false : 'aggregators'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setValue: this.propUpdater('aggregatorName')
|
setValue: this.propUpdater('aggregatorName')
|
||||||
@ -582,7 +596,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
role: 'button',
|
role: 'button',
|
||||||
className: 'pvtRowOrder',
|
className: 'pvtRowOrder',
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return _this8.propUpdater('rowOrder')(sortIcons[_this8.props.rowOrder].next);
|
return _this9.propUpdater('rowOrder')(sortIcons[_this9.props.rowOrder].next);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortIcons[this.props.rowOrder].rowSymbol
|
sortIcons[this.props.rowOrder].rowSymbol
|
||||||
@ -593,7 +607,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
role: 'button',
|
role: 'button',
|
||||||
className: 'pvtColOrder',
|
className: 'pvtColOrder',
|
||||||
onClick: function onClick() {
|
onClick: function onClick() {
|
||||||
return _this8.propUpdater('colOrder')(sortIcons[_this8.props.colOrder].next);
|
return _this9.propUpdater('colOrder')(sortIcons[_this9.props.colOrder].next);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortIcons[this.props.colOrder].colSymbol
|
sortIcons[this.props.colOrder].colSymbol
|
||||||
@ -602,19 +616,19 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
new Array(numValsAllowed).fill().map(function (n, i) {
|
new Array(numValsAllowed).fill().map(function (n, i) {
|
||||||
return [_react2.default.createElement(Dropdown, {
|
return [_react2.default.createElement(Dropdown, {
|
||||||
key: i,
|
key: i,
|
||||||
current: _this8.props.vals[i],
|
current: _this9.props.vals[i],
|
||||||
values: Object.keys(_this8.state.attrValues).filter(function (e) {
|
values: Object.keys(_this9.state.attrValues).filter(function (e) {
|
||||||
return !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromAggregators.includes(e);
|
return !_this9.props.hiddenAttributes.includes(e) && !_this9.props.hiddenFromAggregators.includes(e);
|
||||||
}),
|
}),
|
||||||
open: _this8.isOpen('val' + i),
|
open: _this9.isOpen('val' + i),
|
||||||
zIndex: _this8.isOpen('val' + i) ? _this8.state.maxZIndex + 1 : 1,
|
zIndex: _this9.isOpen('val' + i) ? _this9.state.maxZIndex + 1 : 1,
|
||||||
toggle: function toggle() {
|
toggle: function toggle() {
|
||||||
return _this8.setState({
|
return _this9.setState({
|
||||||
openDropdown: _this8.isOpen('val' + i) ? false : 'val' + i
|
openDropdown: _this9.isOpen('val' + i) ? false : 'val' + i
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setValue: function setValue(value) {
|
setValue: function setValue(value) {
|
||||||
return _this8.sendPropUpdate({
|
return _this9.sendPropUpdate({
|
||||||
vals: { $splice: [[i, 1, value]] }
|
vals: { $splice: [[i, 1, value]] }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -624,7 +638,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var unusedAttrs = Object.keys(this.state.attrValues).filter(function (e) {
|
var unusedAttrs = Object.keys(this.state.attrValues).filter(function (e) {
|
||||||
return !_this8.props.rows.includes(e) && !_this8.props.cols.includes(e) && !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromDragDrop.includes(e);
|
return !_this9.props.rows.includes(e) && !_this9.props.cols.includes(e) && !_this9.props.hiddenAttributes.includes(e) && !_this9.props.hiddenFromDragDrop.includes(e);
|
||||||
}).sort((0, _Utilities.sortAs)(this.state.unusedOrder));
|
}).sort((0, _Utilities.sortAs)(this.state.unusedOrder));
|
||||||
|
|
||||||
var unusedLength = unusedAttrs.reduce(function (r, e) {
|
var unusedLength = unusedAttrs.reduce(function (r, e) {
|
||||||
@ -633,17 +647,17 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
var horizUnused = unusedLength < this.props.unusedOrientationCutoff;
|
var horizUnused = unusedLength < this.props.unusedOrientationCutoff;
|
||||||
|
|
||||||
var unusedAttrsCell = this.makeDnDCell(unusedAttrs, function (order) {
|
var unusedAttrsCell = this.makeDnDCell(unusedAttrs, function (order) {
|
||||||
return _this8.setState({ unusedOrder: order });
|
return _this9.setState({ unusedOrder: order });
|
||||||
}, 'pvtAxisContainer pvtUnused ' + (horizUnused ? 'pvtHorizList' : 'pvtVertList'));
|
}, 'pvtAxisContainer pvtUnused ' + (horizUnused ? 'pvtHorizList' : 'pvtVertList'));
|
||||||
|
|
||||||
var colAttrs = this.props.cols.filter(function (e) {
|
var colAttrs = this.props.cols.filter(function (e) {
|
||||||
return !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromDragDrop.includes(e);
|
return !_this9.props.hiddenAttributes.includes(e) && !_this9.props.hiddenFromDragDrop.includes(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
var colAttrsCell = this.makeDnDCell(colAttrs, this.propUpdater('cols'), 'pvtAxisContainer pvtHorizList pvtCols');
|
var colAttrsCell = this.makeDnDCell(colAttrs, this.propUpdater('cols'), 'pvtAxisContainer pvtHorizList pvtCols');
|
||||||
|
|
||||||
var rowAttrs = this.props.rows.filter(function (e) {
|
var rowAttrs = this.props.rows.filter(function (e) {
|
||||||
return !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromDragDrop.includes(e);
|
return !_this9.props.hiddenAttributes.includes(e) && !_this9.props.hiddenFromDragDrop.includes(e);
|
||||||
});
|
});
|
||||||
var rowAttrsCell = this.makeDnDCell(rowAttrs, this.propUpdater('rows'), 'pvtAxisContainer pvtVertList pvtRows');
|
var rowAttrsCell = this.makeDnDCell(rowAttrs, this.propUpdater('rows'), 'pvtAxisContainer pvtVertList pvtRows');
|
||||||
var outputCell = _react2.default.createElement(
|
var outputCell = _react2.default.createElement(
|
||||||
@ -661,7 +675,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ onClick: function onClick() {
|
{ onClick: function onClick() {
|
||||||
return _this8.setState({ openDropdown: false });
|
return _this9.setState({ openDropdown: false });
|
||||||
} },
|
} },
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
@ -679,7 +693,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
this.props.hideConfiguration && _react2.default.createElement(
|
this.props.hideConfiguration && _react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ onClick: function onClick() {
|
{ onClick: function onClick() {
|
||||||
return _this8.setState({ openDropdown: false });
|
return _this9.setState({ openDropdown: false });
|
||||||
} },
|
} },
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
@ -690,7 +704,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
!this.props.hideConfiguration && _react2.default.createElement(
|
!this.props.hideConfiguration && _react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ onClick: function onClick() {
|
{ onClick: function onClick() {
|
||||||
return _this8.setState({ openDropdown: false });
|
return _this9.setState({ openDropdown: false });
|
||||||
} },
|
} },
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
@ -720,7 +734,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
this.props.hideConfiguration && _react2.default.createElement(
|
this.props.hideConfiguration && _react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ onClick: function onClick() {
|
{ onClick: function onClick() {
|
||||||
return _this8.setState({ openDropdown: false });
|
return _this9.setState({ openDropdown: false });
|
||||||
} },
|
} },
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
@ -731,7 +745,7 @@ var PivotTableUI = function (_React$PureComponent2) {
|
|||||||
!this.props.hideConfiguration && _react2.default.createElement(
|
!this.props.hideConfiguration && _react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ onClick: function onClick() {
|
{ onClick: function onClick() {
|
||||||
return _this8.setState({ openDropdown: false });
|
return _this9.setState({ openDropdown: false });
|
||||||
} },
|
} },
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
|
File diff suppressed because one or more lines are too long
@ -86,13 +86,10 @@ function makeRenderer() {
|
|||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var pivotData = new _Utilities.PivotData(this.props);
|
var pivotData = new _Utilities.PivotData(this.props);
|
||||||
console.log(' TableRenderer pivotData ', pivotData);
|
|
||||||
var colAttrs = pivotData.props.cols;
|
var colAttrs = pivotData.props.cols;
|
||||||
var rowAttrs = pivotData.props.rows;
|
var rowAttrs = pivotData.props.rows;
|
||||||
var rowKeys = pivotData.getRowKeys();
|
var rowKeys = pivotData.getRowKeys();
|
||||||
console.log(' TableRenderer rowKeys ', rowKeys);
|
|
||||||
var colKeys = pivotData.getColKeys();
|
var colKeys = pivotData.getColKeys();
|
||||||
console.log(' TableRenderer colKeys ', colKeys);
|
|
||||||
var grandTotalAggregator = pivotData.getAggregator([], []);
|
var grandTotalAggregator = pivotData.getAggregator([], []);
|
||||||
|
|
||||||
var getStylesHeaders = function getStylesHeaders() {
|
var getStylesHeaders = function getStylesHeaders() {
|
||||||
|
File diff suppressed because one or more lines are too long
17
package.json
17
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "v-react-pivottable",
|
"name": "v-react-pivottable",
|
||||||
"version": "0.11.35",
|
"version": "0.11.36",
|
||||||
"description": "A React-based pivot table",
|
"description": "A React-based pivot table",
|
||||||
"main": "PivotTableUI.js",
|
"main": "PivotTableUI.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -16,20 +16,7 @@
|
|||||||
"Utilities.js.map",
|
"Utilities.js.map",
|
||||||
"pivottable.css"
|
"pivottable.css"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {},
|
||||||
"start": "webpack-dev-server",
|
|
||||||
"test:eslint": "eslint src/*.js* && echo 'eslint: \\033[0;32m'PASS'\\033[0m'",
|
|
||||||
"test:eslint:fix": "eslint src/*.js* --fix",
|
|
||||||
"test:prettier": "prettier -l \"src/*.js*\" && echo 'prettier: \\033[0;32m'PASS'\\033[0m'",
|
|
||||||
"test:prettier:fix": "prettier --write \"src/*.js*\"",
|
|
||||||
"test:jest": "jest",
|
|
||||||
"test": "npm run test:eslint && npm run test:prettier && npm run test:jest",
|
|
||||||
"clean": "rm -rf __tests__ PivotTable.js* PivotTableUI.js* PlotlyRenderers.js* TableRenderers.js* Utilities.js* pivottable.css",
|
|
||||||
"build": "npm run clean && cp src/pivottable.css . && babel src --out-dir=. --source-maps --presets=env,react --plugins babel-plugin-add-module-exports",
|
|
||||||
"doPublish": "npm run build && npm publish",
|
|
||||||
"postpublish": "npm run clean",
|
|
||||||
"deploy": "webpack -p && mv bundle.js examples && cd examples && git init && git add . && git commit -m build && git push --force git@github.com:plotly/react-pivottable.git master:gh-pages && rm -rf .git bundle.js"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/plotly/react-pivottable.git"
|
"url": "git+https://github.com/plotly/react-pivottable.git"
|
||||||
|
Loading…
Reference in New Issue
Block a user