react-bootstrap-table-next
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -27,2 +27,6 @@ 'use strict'; | ||
var _columnContext = require('./column-context'); | ||
var _columnContext2 = _interopRequireDefault(_columnContext); | ||
var _sortContext = require('./sort-context'); | ||
@@ -89,2 +93,8 @@ | ||
if (props.columnToggle || props.columns.filter(function (col) { | ||
return col.hidden; | ||
}).length > 0) { | ||
_this.ColumnManagementContext = (0, _columnContext2.default)(); | ||
} | ||
if (props.selectRow) { | ||
@@ -139,3 +149,3 @@ _this.SelectionContext = _selectionContext2.default; | ||
return function (rootProps, filterProps, searchProps, sortProps, paginationProps) { | ||
return function (rootProps, filterProps, searchProps, sortProps, paginationProps, columnToggleProps) { | ||
return _react2.default.createElement(Base, _extends({ | ||
@@ -145,3 +155,3 @@ ref: function ref(n) { | ||
} | ||
}, _this2.props, sortProps, filterProps, searchProps, paginationProps, { | ||
}, _this2.props, sortProps, filterProps, searchProps, paginationProps, columnToggleProps, { | ||
data: rootProps.getData(filterProps, searchProps, sortProps, paginationProps) | ||
@@ -152,14 +162,35 @@ })); | ||
}, { | ||
key: 'renderWithColumnManagementCtx', | ||
value: function renderWithColumnManagementCtx(base, baseProps) { | ||
var _this3 = this; | ||
return function (rootProps, filterProps, searchProps, sortProps, paginationProps) { | ||
return _react2.default.createElement( | ||
_this3.ColumnManagementContext.Provider, | ||
_extends({}, baseProps, { | ||
toggles: _this3.props.columnToggle ? _this3.props.columnToggle.toggles : null | ||
}), | ||
_react2.default.createElement( | ||
_this3.ColumnManagementContext.Consumer, | ||
null, | ||
function (columnToggleProps) { | ||
return base(rootProps, filterProps, searchProps, sortProps, paginationProps, columnToggleProps); | ||
} | ||
) | ||
); | ||
}; | ||
} | ||
}, { | ||
key: 'renderWithSelectionCtx', | ||
value: function renderWithSelectionCtx(base, baseProps) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
return function (rootProps, filterProps, searchProps, sortProps, paginationProps) { | ||
return _react2.default.createElement( | ||
_this3.SelectionContext.Provider, | ||
_this4.SelectionContext.Provider, | ||
_extends({}, baseProps, { | ||
ref: function ref(n) { | ||
return _this3.selectionContext = n; | ||
return _this4.selectionContext = n; | ||
}, | ||
selectRow: _this3.props.selectRow, | ||
selectRow: _this4.props.selectRow, | ||
data: rootProps.getData(filterProps, searchProps, sortProps, paginationProps) | ||
@@ -174,12 +205,12 @@ }), | ||
value: function renderWithRowExpandCtx(base, baseProps) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
return function (rootProps, filterProps, searchProps, sortProps, paginationProps) { | ||
return _react2.default.createElement( | ||
_this4.RowExpandContext.Provider, | ||
_this5.RowExpandContext.Provider, | ||
_extends({}, baseProps, { | ||
ref: function ref(n) { | ||
return _this4.rowExpandContext = n; | ||
return _this5.rowExpandContext = n; | ||
}, | ||
expandRow: _this4.props.expandRow, | ||
expandRow: _this5.props.expandRow, | ||
data: rootProps.getData(filterProps, searchProps, sortProps, paginationProps) | ||
@@ -194,19 +225,19 @@ }), | ||
value: function renderWithPaginationCtx(base) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
return function (rootProps, filterProps, searchProps, sortProps) { | ||
return _react2.default.createElement( | ||
_this5.PaginationContext.Provider, | ||
_this6.PaginationContext.Provider, | ||
{ | ||
ref: function ref(n) { | ||
return _this5.paginationContext = n; | ||
return _this6.paginationContext = n; | ||
}, | ||
pagination: _this5.props.pagination, | ||
pagination: _this6.props.pagination, | ||
data: rootProps.getData(filterProps, searchProps, sortProps), | ||
bootstrap4: _this5.props.bootstrap4, | ||
isRemotePagination: _this5.isRemotePagination, | ||
remoteEmitter: _this5.remoteEmitter | ||
bootstrap4: _this6.props.bootstrap4, | ||
isRemotePagination: _this6.isRemotePagination, | ||
remoteEmitter: _this6.remoteEmitter | ||
}, | ||
_react2.default.createElement( | ||
_this5.PaginationContext.Consumer, | ||
_this6.PaginationContext.Consumer, | ||
null, | ||
@@ -223,17 +254,17 @@ function (paginationProps) { | ||
value: function renderWithSortCtx(base, baseProps) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
return function (rootProps, filterProps, searchProps) { | ||
return _react2.default.createElement( | ||
_this6.SortContext.Provider, | ||
_this7.SortContext.Provider, | ||
_extends({}, baseProps, { | ||
ref: function ref(n) { | ||
return _this6.sortContext = n; | ||
return _this7.sortContext = n; | ||
}, | ||
defaultSorted: _this6.props.defaultSorted, | ||
defaultSortDirection: _this6.props.defaultSortDirection, | ||
defaultSorted: _this7.props.defaultSorted, | ||
defaultSortDirection: _this7.props.defaultSortDirection, | ||
data: rootProps.getData(filterProps, searchProps) | ||
}), | ||
_react2.default.createElement( | ||
_this6.SortContext.Consumer, | ||
_this7.SortContext.Consumer, | ||
null, | ||
@@ -250,17 +281,17 @@ function (sortProps) { | ||
value: function renderWithSearchCtx(base, baseProps) { | ||
var _this7 = this; | ||
var _this8 = this; | ||
return function (rootProps, filterProps) { | ||
return _react2.default.createElement( | ||
_this7.SearchContext.Provider, | ||
_this8.SearchContext.Provider, | ||
_extends({}, baseProps, { | ||
ref: function ref(n) { | ||
return _this7.searchContext = n; | ||
return _this8.searchContext = n; | ||
}, | ||
data: rootProps.getData(filterProps), | ||
searchText: _this7.props.search.searchText, | ||
dataChangeListener: _this7.props.dataChangeListener | ||
searchText: _this8.props.search.searchText, | ||
dataChangeListener: _this8.props.dataChangeListener | ||
}), | ||
_react2.default.createElement( | ||
_this7.SearchContext.Consumer, | ||
_this8.SearchContext.Consumer, | ||
null, | ||
@@ -277,16 +308,16 @@ function (searchProps) { | ||
value: function renderWithFilterCtx(base, baseProps) { | ||
var _this8 = this; | ||
var _this9 = this; | ||
return function (rootProps) { | ||
return _react2.default.createElement( | ||
_this8.FilterContext.Provider, | ||
_this9.FilterContext.Provider, | ||
_extends({}, baseProps, { | ||
ref: function ref(n) { | ||
return _this8.filterContext = n; | ||
return _this9.filterContext = n; | ||
}, | ||
data: rootProps.getData(), | ||
dataChangeListener: _this8.props.dataChangeListener | ||
dataChangeListener: _this9.props.dataChangeListener | ||
}), | ||
_react2.default.createElement( | ||
_this8.FilterContext.Consumer, | ||
_this9.FilterContext.Consumer, | ||
null, | ||
@@ -303,10 +334,10 @@ function (filterProps) { | ||
value: function renderWithCellEditCtx(base, baseProps) { | ||
var _this9 = this; | ||
var _this10 = this; | ||
return function (rootProps) { | ||
return _react2.default.createElement( | ||
_this9.CellEditContext.Provider, | ||
_this10.CellEditContext.Provider, | ||
_extends({}, baseProps, { | ||
selectRow: _this9.props.selectRow, | ||
cellEdit: _this9.props.cellEdit, | ||
selectRow: _this10.props.selectRow, | ||
cellEdit: _this10.props.cellEdit, | ||
data: rootProps.getData() | ||
@@ -330,2 +361,6 @@ }), | ||
if (this.ColumnManagementContext) { | ||
base = this.renderWithColumnManagementCtx(base, baseProps); | ||
} | ||
if (this.SelectionContext) { | ||
@@ -332,0 +367,0 @@ base = this.renderWithSelectionCtx(base, baseProps); |
@@ -49,3 +49,3 @@ 'use strict'; | ||
var childrens = columns.map(function (column, i) { | ||
if (column.footer === undefined || column.footer === null || column.hidden) { | ||
if (column.footer === undefined || column.footer === null) { | ||
return false; | ||
@@ -52,0 +52,0 @@ } |
@@ -75,19 +75,16 @@ 'use strict'; | ||
var childrens = [columns.map(function (column, i) { | ||
if (!column.hidden) { | ||
var currSort = column.dataField === sortField; | ||
var isLastSorting = column.dataField === sortField; | ||
var currSort = column.dataField === sortField; | ||
var isLastSorting = column.dataField === sortField; | ||
return _react2.default.createElement(_headerCell2.default, { | ||
index: i, | ||
key: column.dataField, | ||
column: column, | ||
onSort: onSort, | ||
sorting: currSort, | ||
onFilter: onFilter, | ||
onExternalFilter: onExternalFilter, | ||
sortOrder: sortOrder, | ||
isLastSorting: isLastSorting | ||
}); | ||
} | ||
return false; | ||
return _react2.default.createElement(_headerCell2.default, { | ||
index: i, | ||
key: column.dataField, | ||
column: column, | ||
onSort: onSort, | ||
sorting: currSort, | ||
onFilter: onFilter, | ||
onExternalFilter: onExternalFilter, | ||
sortOrder: sortOrder, | ||
isLastSorting: isLastSorting | ||
}); | ||
})]; | ||
@@ -94,0 +91,0 @@ |
@@ -86,2 +86,3 @@ 'use strict'; | ||
tabIndex = _props2.tabIndex, | ||
rowIndex = _props2.rowIndex, | ||
selectionRenderer = _props2.selectionRenderer; | ||
@@ -104,3 +105,4 @@ | ||
checked: selected, | ||
disabled: disabled | ||
disabled: disabled, | ||
rowIndex: rowIndex | ||
}) : _react2.default.createElement('input', { | ||
@@ -107,0 +109,0 @@ type: inputType, |
@@ -72,77 +72,74 @@ 'use strict'; | ||
return columns.map(function (column, index) { | ||
if (!column.hidden) { | ||
var dataField = column.dataField; | ||
var dataField = column.dataField; | ||
var content = _utils2.default.get(row, dataField); | ||
if (rowIndex === editingRowIdx && index === editingColIdx) { | ||
return _react2.default.createElement(EditingCellComponent, { | ||
key: content + '-' + index + '-editing', | ||
row: row, | ||
rowIndex: rowIndex, | ||
column: column, | ||
columnIndex: index | ||
}); | ||
} | ||
// render cell | ||
var cellTitle = void 0; | ||
var cellStyle = {}; | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(column.attrs) ? column.attrs(content, row, rowIndex, index) : column.attrs); | ||
var content = _utils2.default.get(row, dataField); | ||
if (rowIndex === editingRowIdx && index === editingColIdx) { | ||
return _react2.default.createElement(EditingCellComponent, { | ||
key: content + '-' + index + '-editing', | ||
row: row, | ||
rowIndex: rowIndex, | ||
column: column, | ||
columnIndex: index | ||
}); | ||
} | ||
// render cell | ||
var cellTitle = void 0; | ||
var cellStyle = {}; | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(column.attrs) ? column.attrs(content, row, rowIndex, index) : column.attrs); | ||
if (column.events) { | ||
var events = Object.assign({}, column.events); | ||
Object.keys(Object.assign({}, column.events)).forEach(function (key) { | ||
var originFn = events[key]; | ||
events[key] = function () { | ||
for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) { | ||
rest[_key] = arguments[_key]; | ||
} | ||
if (column.events) { | ||
var events = Object.assign({}, column.events); | ||
Object.keys(Object.assign({}, column.events)).forEach(function (key) { | ||
var originFn = events[key]; | ||
events[key] = function () { | ||
for (var _len = arguments.length, rest = Array(_len), _key = 0; _key < _len; _key++) { | ||
rest[_key] = arguments[_key]; | ||
} | ||
return originFn.apply(undefined, rest.concat([row, rowIndex])); | ||
}; | ||
}); | ||
cellAttrs = _extends({}, cellAttrs, events); | ||
} | ||
return originFn.apply(undefined, rest.concat([row, rowIndex])); | ||
}; | ||
}); | ||
cellAttrs = _extends({}, cellAttrs, events); | ||
} | ||
var cellClasses = _utils2.default.isFunction(column.classes) ? column.classes(content, row, rowIndex, index) : column.classes; | ||
var cellClasses = _utils2.default.isFunction(column.classes) ? column.classes(content, row, rowIndex, index) : column.classes; | ||
if (column.style) { | ||
cellStyle = _utils2.default.isFunction(column.style) ? column.style(content, row, rowIndex, index) : column.style; | ||
cellStyle = Object.assign({}, cellStyle) || {}; | ||
} | ||
if (column.style) { | ||
cellStyle = _utils2.default.isFunction(column.style) ? column.style(content, row, rowIndex, index) : column.style; | ||
cellStyle = Object.assign({}, cellStyle) || {}; | ||
} | ||
if (column.title) { | ||
cellTitle = _utils2.default.isFunction(column.title) ? column.title(content, row, rowIndex, index) : content; | ||
cellAttrs.title = cellTitle; | ||
} | ||
if (column.title) { | ||
cellTitle = _utils2.default.isFunction(column.title) ? column.title(content, row, rowIndex, index) : content; | ||
cellAttrs.title = cellTitle; | ||
} | ||
if (column.align) { | ||
cellStyle.textAlign = _utils2.default.isFunction(column.align) ? column.align(content, row, rowIndex, index) : column.align; | ||
} | ||
if (column.align) { | ||
cellStyle.textAlign = _utils2.default.isFunction(column.align) ? column.align(content, row, rowIndex, index) : column.align; | ||
} | ||
if (cellClasses) cellAttrs.className = cellClasses; | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
if (cellClasses) cellAttrs.className = cellClasses; | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
var editableCell = _utils2.default.isDefined(column.editable) ? column.editable : true; | ||
if (column.dataField === keyField || !editable) editableCell = false; | ||
if (_utils2.default.isFunction(column.editable)) { | ||
editableCell = column.editable(content, row, rowIndex, index); | ||
} | ||
var editableCell = _utils2.default.isDefined(column.editable) ? column.editable : true; | ||
if (column.dataField === keyField || !editable) editableCell = false; | ||
if (_utils2.default.isFunction(column.editable)) { | ||
editableCell = column.editable(content, row, rowIndex, index); | ||
} | ||
if (tabIndexStart !== -1) { | ||
cellAttrs.tabIndex = tabIndex++; | ||
} | ||
if (tabIndexStart !== -1) { | ||
cellAttrs.tabIndex = tabIndex++; | ||
} | ||
return _react2.default.createElement(_cell2.default, _extends({ | ||
key: content + '-' + index, | ||
row: row, | ||
editable: editableCell, | ||
rowIndex: rowIndex, | ||
columnIndex: index, | ||
column: column, | ||
onStart: onStart, | ||
clickToEdit: clickToEdit, | ||
dbclickToEdit: dbclickToEdit | ||
}, cellAttrs)); | ||
} | ||
return false; | ||
return _react2.default.createElement(_cell2.default, _extends({ | ||
key: content + '-' + index, | ||
row: row, | ||
editable: editableCell, | ||
rowIndex: rowIndex, | ||
columnIndex: index, | ||
column: column, | ||
onStart: onStart, | ||
clickToEdit: clickToEdit, | ||
dbclickToEdit: dbclickToEdit | ||
}, cellAttrs)); | ||
}); | ||
@@ -149,0 +146,0 @@ } |
{ | ||
"name": "react-bootstrap-table-next", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Next generation of react-bootstrap-table", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
890322
52
10505