This commit is contained in:
huyueb 2018-04-02 19:35:15 +08:00
parent 59530c8527
commit 0cca9cadd6
5 changed files with 290 additions and 45385 deletions

View File

@ -20,6 +20,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
@ -166,14 +168,24 @@ function multiSelect(Table) {
selectDisabled = props.selectDisabled,
selectedRow = props.selectedRow,
data = props.data,
selIds_ = _this4.state.selIds;
selIds_ = [].concat(_toConsumableArray(_this4.state.selIds)),
selIds_length = selIds_.length;
for (var i = 0; i < data.length; i++) {
var bool = selectDisabled && selectDisabled(data[i], i) || false;
var rowKey = data[i]["key"] ? data[i]["key"] : _this4.getRowKey(data[i], i);
if (!bool) {
if (selectedRow && selectedRow(data[i], i)) {
selIds_.push(data[i]);
if (selIds_length > 0) {
for (var index = 0; index < selIds_length; index++) {
var selid = selIds_[index];
if (selid[rowKey] !== data[i][rowKey]) {
selIds_.push(data[i]);
}
}
} else {
selIds_.push(data[i]);
}
checkedObj[rowKey] = true;
} else {
checkedObj[rowKey] = false;

45641
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.0.16",
"version": "1.0.17",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -64,13 +64,23 @@ export default function multiSelect(Table) {
initCheckedObj = (props) => {
let checkedObj = {},
{ selectDisabled, selectedRow, data } = props,
selIds_ = this.state.selIds;
selIds_ = [...this.state.selIds],
selIds_length = selIds_.length;
for (var i = 0; i < data.length; i++) {
let bool = (selectDisabled && selectDisabled(data[i], i)) || false;
let rowKey = data[i]["key"] ? data[i]["key"] : this.getRowKey(data[i],i);
if (!bool) {
if(selectedRow && selectedRow(data[i], i)){
selIds_.push(data[i]);
if(selIds_length>0){
for (let index = 0; index < selIds_length; index++) {
const selid = selIds_[index];
if(selid[rowKey] !== data[i][rowKey]){
selIds_.push(data[i]);
}
}
}else{
selIds_.push(data[i]);
}
checkedObj[rowKey] = true;
}else{
checkedObj[rowKey] = false;