mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-10-03 17:06:53 +00:00
@@ -1,3 +1,5 @@
|
||||
import _ from './utils';
|
||||
|
||||
const events = [
|
||||
'onClick',
|
||||
'onDoubleClick',
|
||||
@@ -23,7 +25,7 @@ export default ExtendBase =>
|
||||
delegate(attrs = {}) {
|
||||
const newAttrs = { ...attrs };
|
||||
Object.keys(attrs).forEach((attr) => {
|
||||
if (events.includes(attr)) {
|
||||
if (_.contains(events, attr)) {
|
||||
newAttrs[attr] = this.createDefaultEventHandler(attrs[attr]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ class RowExpandProvider extends React.Component {
|
||||
if (nextProps.expandRow) {
|
||||
const nextExpanded = nextProps.expandRow.expanded || this.state.expanded;
|
||||
const isClosing = this.state.expanded.reduce((acc, cur) => {
|
||||
if (!nextExpanded.includes(cur)) {
|
||||
if (!_.contains(nextExpanded, cur)) {
|
||||
acc.push(cur);
|
||||
}
|
||||
return acc;
|
||||
@@ -42,7 +42,7 @@ class RowExpandProvider extends React.Component {
|
||||
|
||||
handleRowExpand = (rowKey, expanded, rowIndex, e) => {
|
||||
const { data, keyField, expandRow: { onExpand, onlyOneExpanding, nonExpandable } } = this.props;
|
||||
if (nonExpandable && nonExpandable.includes(rowKey)) {
|
||||
if (nonExpandable && _.contains(nonExpandable, rowKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export default ExtendBase =>
|
||||
if (!hiddenRows || hiddenRows.length === 0) return data;
|
||||
return data.filter((row) => {
|
||||
const key = _.get(row, keyField);
|
||||
return !hiddenRows.includes(key);
|
||||
return !_.contains(hiddenRows, key);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
/* eslint react/prop-types: 0 */
|
||||
import React from 'react';
|
||||
import ExpandRow from './expand-row';
|
||||
import _ from '../utils';
|
||||
import ExpansionContext from '../contexts/row-expand-context';
|
||||
|
||||
export default (Component) => {
|
||||
const renderWithExpansion = (props, expandRow) => {
|
||||
const key = props.value;
|
||||
|
||||
const expanded = expandRow.expanded.includes(key);
|
||||
const isClosing = expandRow.isClosing.includes(key);
|
||||
const expandable = !expandRow.nonExpandable || !expandRow.nonExpandable.includes(key);
|
||||
const expanded = _.contains(expandRow.expanded, key);
|
||||
const isClosing = _.contains(expandRow.isClosing, key);
|
||||
const expandable = !expandRow.nonExpandable || !_.contains(expandRow.nonExpandable, key);
|
||||
return [
|
||||
<Component
|
||||
{ ...props }
|
||||
|
||||
@@ -7,8 +7,8 @@ import SelectionContext from '../contexts/selection-context';
|
||||
export default (Component) => {
|
||||
const renderWithSelection = (props, selectRow) => {
|
||||
const key = props.value;
|
||||
const selected = selectRow.selected.includes(key);
|
||||
const selectable = !selectRow.nonSelectable || !selectRow.nonSelectable.includes(key);
|
||||
const selected = _.contains(selectRow.selected, key);
|
||||
const selectable = !selectRow.nonSelectable || !_.contains(selectRow.nonSelectable, key);
|
||||
|
||||
let {
|
||||
style,
|
||||
|
||||
@@ -74,7 +74,7 @@ export default ExtendBase =>
|
||||
delegate(attrs = {}) {
|
||||
const newAttrs = { ...attrs };
|
||||
Object.keys(attrs).forEach((attr) => {
|
||||
if (events.includes(attr)) {
|
||||
if (_.contains(events, attr)) {
|
||||
newAttrs[attr] = this.createDefaultEventHandler(attrs[attr]);
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export const expandableKeys = (data, keyField, skips = []) => {
|
||||
return data.map(row => _.get(row, keyField));
|
||||
}
|
||||
return data
|
||||
.filter(row => !skips.includes(_.get(row, keyField)))
|
||||
.filter(row => !_.contains(skips, _.get(row, keyField)))
|
||||
.map(row => _.get(row, keyField));
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ export const selectableKeys = (data, keyField, skips = []) => {
|
||||
return data.map(row => _.get(row, keyField));
|
||||
}
|
||||
return data
|
||||
.filter(row => !skips.includes(_.get(row, keyField)))
|
||||
.filter(row => !_.contains(skips, _.get(row, keyField)))
|
||||
.map(row => _.get(row, keyField));
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ export const unSelectableKeys = (selected, skips = []) => {
|
||||
if (skips.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return selected.filter(x => skips.includes(x));
|
||||
return selected.filter(x => _.contains(skips, x));
|
||||
};
|
||||
|
||||
export const getSelectedRows = (data, keyField, selected) =>
|
||||
|
||||
Reference in New Issue
Block a user