多选逻辑调整主要是disabled计算

This commit is contained in:
wanghaoo 2018-12-05 10:03:11 +08:00
parent d6dcbad699
commit f2c99f0cc7
5 changed files with 43 additions and 59 deletions

View File

@ -99,13 +99,17 @@ function multiSelect(Table, Checkbox) {
if (!this.isArray(data)) return false;
if (data.length == 0) return false;
var count = 0;
var disabledCount = 0;
data.forEach(function (da) {
if (da._checked) {
count++;
}
if (da._disabled) {
disabledCount++;
}
});
if (data.length == count) {
if (data.length == count + disabledCount) {
return "all";
}
return count == 0 ? false : "indeter";

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

86
dist/demo.js vendored
View File

@ -7237,7 +7237,7 @@
duration: _propTypes2["default"].number,
onClose: _propTypes2["default"].func,
children: _propTypes2["default"].any,
color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
color: _propTypes2["default"].oneOf(['light']),
title: _propTypes2["default"].any
};
@ -7336,7 +7336,7 @@
;
Notice.propTypes = propTypes;
Notice.PropTypes = _propTypes2["default"];
Notice.defaultProps = defaultProps;
exports["default"] = Notice;
@ -21693,15 +21693,15 @@
InputNumber.prototype.ComponentWillMount = function ComponentWillMount() {};
InputNumber.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!nextProps.hasOwnProperty('precision')) {
var data = judgeValue(nextProps);
this.setState({
value: data.value,
minusDisabled: data.minusDisabled,
plusDisabled: data.plusDisabled
});
this.tempStorage = data.value;
}
// if(!nextProps.hasOwnProperty('precision')){//如果没有 precision
var data = judgeValue(nextProps);
this.setState({
value: data.value,
minusDisabled: data.minusDisabled,
plusDisabled: data.plusDisabled
});
this.tempStorage = data.value;
// }
};
InputNumber.prototype.ComponentWillUnMount = function ComponentWillUnMount() {
@ -53663,13 +53663,17 @@
if (!this.isArray(data)) return false;
if (data.length == 0) return false;
var count = 0;
var disabledCount = 0;
data.forEach(function (da) {
if (da._checked) {
count++;
}
if (da._disabled) {
disabledCount++;
}
});
if (data.length == count) {
if (data.length == count + disabledCount) {
return "all";
}
return count == 0 ? false : "indeter";
@ -59506,18 +59510,18 @@
}
};
Popconfirm.prototype.handleClose = function handleClose(e) {
Popconfirm.prototype.handleClose = function handleClose() {
var onClose = this.props.onClose;
this.hide();
onClose && onClose(e);
onClose && onClose();
};
Popconfirm.prototype.handleCancel = function handleCancel(e) {
Popconfirm.prototype.handleCancel = function handleCancel() {
var onCancel = this.props.onCancel;
this.hide();
onCancel && onCancel(e);
onCancel && onCancel();
};
Popconfirm.prototype.handleHide = function handleHide() {
@ -59553,8 +59557,7 @@
content = _props.content,
children = _props.children,
onClick = _props.onClick,
stopbubble = _props.stopbubble,
props = _objectWithoutProperties(_props, ['content', 'children', 'onClick', 'stopbubble']);
props = _objectWithoutProperties(_props, ['content', 'children', 'onClick']);
delete props.defaultOverlayShown;
@ -59571,7 +59574,6 @@
_extends({}, confirmProps, {
onClose: this.handleClose,
onCancel: this.handleCancel,
stopbubble: stopbubble,
placement: props.placement }),
content
);
@ -59686,11 +59688,6 @@
*/
arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
/**
* 阻止冒泡
*/
stopbubble: _propTypes2["default"].number,
/**
* Title content
*/
@ -59701,7 +59698,6 @@
};
var defaultProps = {
stopbubble: 0,
placement: 'right',
clsPrefix: 'u-popconfirm',
locale: {}
@ -59713,27 +59709,7 @@
function Confirm(props) {
_classCallCheck(this, Confirm);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.cancel = function (e) {
var _this$props = _this.props,
stopbubble = _this$props.stopbubble,
onCancel = _this$props.onCancel;
stopbubble && e.stopPropagation();
onCancel(e);
};
_this.close = function (e) {
var _this$props2 = _this.props,
stopbubble = _this$props2.stopbubble,
onClose = _this$props2.onClose;
stopbubble && e.stopPropagation();
onClose(e);
};
return _this;
return _possibleConstructorReturn(this, _React$Component.call(this, props));
}
Confirm.prototype.render = function render() {
@ -59755,8 +59731,7 @@
onClose = _props.onClose,
color = _props.color,
onCancel = _props.onCancel,
stopbubble = _props.stopbubble,
props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'clsPrefix', 'trigger', 'title', 'className', 'style', 'children', 'locale', 'onClose', 'color', 'onCancel', 'stopbubble']);
props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'clsPrefix', 'trigger', 'title', 'className', 'style', 'children', 'locale', 'onClose', 'color', 'onCancel']);
var local = (0, _tool.getComponentLocale)(this.props, this.context, 'Popconfirm', function () {
return _i18n2["default"];
@ -59782,10 +59757,7 @@
_extends({}, props, {
role: 'tooltip',
className: (0, _classnames2["default"])(className, classes),
style: outerStyle,
onClick: function onClick(e) {
return stopbubble && e.stopPropagation();
}
style: outerStyle
}),
_react2["default"].createElement('div', { className: 'arrow', style: arrowStyle }),
_react2["default"].createElement(
@ -59798,13 +59770,13 @@
{ className: (0, _classnames2["default"])(clsPrefix + '-confirm') },
_react2["default"].createElement(
_beeButton2["default"],
{ onClick: this.cancel, size: 'sm', style: { minWidth: 50 },
{ onClick: onCancel, size: 'sm', style: { minWidth: 50 },
shape: 'border' },
local['cancel']
),
_react2["default"].createElement(
_beeButton2["default"],
{ onClick: this.close, size: 'sm', style: { minWidth: 50 }, colors: 'primary' },
{ onClick: onClose, size: 'sm', style: { minWidth: 50 }, colors: 'primary' },
local['ok']
)
)
@ -64058,13 +64030,17 @@
if (!this.isArray(data)) return false;
if (data.length == 0) return false;
var count = 0;
var disabledCount = 0;
data.forEach(function (da) {
if (da._checked) {
count++;
}
if (da._disabled) {
disabledCount++;
}
});
if (data.length == count) {
if (data.length == count + disabledCount) {
return "all";
}
return count == 0 ? false : "indeter";

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -65,13 +65,17 @@ export default function multiSelect(Table, Checkbox) {
if(!this.isArray(data))return false;
if(data.length == 0)return false;
let count = 0;
let disabledCount = 0;
data.forEach(da=>{
if(da._checked){
count ++;
}
if(da._disabled){
disabledCount ++;
}
})
if(data.length == count){
if(data.length == count + disabledCount){
return "all";
}
return count == 0?false:"indeter";