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

File diff suppressed because one or more lines are too long

View File

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