test cambiar de usar props a usar state

This commit is contained in:
dehernandezm 2025-02-14 16:07:53 -06:00
parent 3ef6000f5c
commit b6b3ac4396
3 changed files with 11 additions and 8 deletions

View File

@ -364,7 +364,7 @@ var PivotTableUI = function (_React$PureComponent2) {
attrValues: {}, attrValues: {},
materializedInput: [], materializedInput: [],
hideConfiguration: false, hideConfiguration: false,
showSubtotales: false, showSubtotales: props.showSubtotales,
headerClass: '', headerClass: '',
stylesHeaders: {} stylesHeaders: {}
}; };
@ -595,7 +595,7 @@ var PivotTableUI = function (_React$PureComponent2) {
className: classes, className: classes,
onChange: onChange onChange: onChange
}, },
headSlot && typeof headSlot === 'function' && headSlot(), headSlot && typeof headSlot === 'function' && items.length > 1 && headSlot(),
items.map(function (x) { items.map(function (x) {
return _react2.default.createElement(DraggableAttribute, { return _react2.default.createElement(DraggableAttribute, {
name: x, name: x,
@ -741,8 +741,9 @@ var PivotTableUI = function (_React$PureComponent2) {
return !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromDragDrop.includes(e); return !_this8.props.hiddenAttributes.includes(e) && !_this8.props.hiddenFromDragDrop.includes(e);
}); });
var toggleSubTotales = function toggleSubTotales() { var toggleSubTotales = function toggleSubTotales() {
var _showSubt = _this8.props.showSubtotales; var _showSubt = Boolean(_this8.props.showSubtotales);
_this8.propUpdater('showSubtotales')(!_showSubt); _this8.propUpdater('showSubtotales')(!_showSubt);
_this8.setState({ showSubtotales: !_showSubt });
}; };
var renderCheckSubtotal = function renderCheckSubtotal() { var renderCheckSubtotal = function renderCheckSubtotal() {
return _react2.default.createElement( return _react2.default.createElement(
@ -758,9 +759,9 @@ var PivotTableUI = function (_React$PureComponent2) {
), ),
_react2.default.createElement('input', { _react2.default.createElement('input', {
type: 'checkbox', type: 'checkbox',
checked: _this8.props.showSubtotales, checked: _this8.state.showSubtotales,
className: 'via-checkbox h-5 w-5 cursor-pointer', className: 'via-checkbox h-5 w-5 cursor-pointer',
onChange: function onChange(e) { onChange: function onChange() {
toggleSubTotales(); toggleSubTotales();
} }
}) })
@ -885,6 +886,7 @@ PivotTableUI.propTypes = Object.assign({}, _PivotTable2.default.propTypes, {
unusedOrientationCutoff: _propTypes2.default.number, unusedOrientationCutoff: _propTypes2.default.number,
menuLimit: _propTypes2.default.number, menuLimit: _propTypes2.default.number,
hideConfiguration: _propTypes2.default.bool, hideConfiguration: _propTypes2.default.bool,
showSubtotales: _propTypes2.default.bool,
headerClass: _propTypes2.default.string, headerClass: _propTypes2.default.string,
stylesHeaders: _propTypes2.default.object stylesHeaders: _propTypes2.default.object
}); });
@ -895,7 +897,8 @@ PivotTableUI.defaultProps = Object.assign({}, _PivotTable2.default.defaultProps,
hiddenFromDragDrop: [], hiddenFromDragDrop: [],
unusedOrientationCutoff: 85, unusedOrientationCutoff: 85,
menuLimit: 500, menuLimit: 500,
hideConfiguration: true hideConfiguration: true,
showSubtotales: true
}); });
exports.default = PivotTableUI; exports.default = PivotTableUI;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "v-react-pivottable", "name": "v-react-pivottable",
"version": "0.11.62", "version": "0.11.63",
"description": "A React-based pivot table", "description": "A React-based pivot table",
"main": "PivotTableUI.js", "main": "PivotTableUI.js",
"files": [ "files": [