react-bootstrap-table-next
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -59,6 +59,19 @@ 'use strict'; | ||
_this.getData = function () { | ||
return _this.props.data; | ||
}; | ||
_this.validateProps(); | ||
if (props.registerExposedAPI) { | ||
var getData = function getData() { | ||
return _this.getData(); | ||
}; | ||
props.registerExposedAPI(getData); | ||
} | ||
return _this; | ||
} | ||
// Exposed APIs | ||
_createClass(BootstrapTable, [{ | ||
@@ -223,3 +236,3 @@ key: 'render', | ||
onAllRowExpand: _propTypes2.default.func, | ||
isAnyExpands: _propTypes2.default.func, | ||
isAnyExpands: _propTypes2.default.bool, | ||
rowStyle: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]), | ||
@@ -226,0 +239,0 @@ rowEvents: _propTypes2.default.object, |
@@ -25,2 +25,4 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -46,2 +48,8 @@ | ||
_createClass(Cell, [{ | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps) { | ||
var shouldUpdate = _utils2.default.get(this.props.row, this.props.column.dataField) !== _utils2.default.get(nextProps.row, nextProps.column.dataField) || this.props.column.hidden !== nextProps.column.hidden || this.props.rowIndex !== nextProps.rowIndex || this.props.columnIndex !== nextProps.columnIndex || this.props.className !== nextProps.className || this.props.title !== nextProps.title || this.props.editable !== nextProps.editable || this.props.clickToEdit !== nextProps.clickToEdit || this.props.dbclickToEdit !== nextProps.dbclickToEdit || !_utils2.default.isEqual(this.props.style, nextProps.style) || !_utils2.default.isEqual(this.props.column.formatExtraData, nextProps.column.formatExtraData) || !_utils2.default.isEqual(this.props.column.events, nextProps.column.events) || !_utils2.default.isEqual(this.props.column.attrs, nextProps.column.attrs); | ||
return shouldUpdate; | ||
} | ||
}, { | ||
key: 'handleEditingCell', | ||
@@ -79,32 +87,15 @@ value: function handleEditingCell(e) { | ||
columnIndex = _props2.columnIndex, | ||
onStart = _props2.onStart, | ||
editable = _props2.editable, | ||
clickToEdit = _props2.clickToEdit, | ||
dbclickToEdit = _props2.dbclickToEdit; | ||
dbclickToEdit = _props2.dbclickToEdit, | ||
rest = _objectWithoutProperties(_props2, ['row', 'rowIndex', 'column', 'columnIndex', 'onStart', 'editable', 'clickToEdit', 'dbclickToEdit']); | ||
var dataField = column.dataField, | ||
formatter = column.formatter, | ||
formatExtraData = column.formatExtraData, | ||
style = column.style, | ||
classes = column.classes, | ||
title = column.title, | ||
events = column.events, | ||
align = column.align, | ||
attrs = column.attrs; | ||
formatExtraData = column.formatExtraData; | ||
var cellTitle = void 0; | ||
var cellStyle = {}; | ||
var attrs = _extends({}, rest); | ||
var content = _utils2.default.get(row, dataField); | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(attrs) ? attrs(content, row, rowIndex, columnIndex) : attrs, events); | ||
var cellClasses = _utils2.default.isFunction(classes) ? classes(content, row, rowIndex, columnIndex) : classes; | ||
if (style) { | ||
cellStyle = _utils2.default.isFunction(style) ? style(content, row, rowIndex, columnIndex) : style; | ||
} | ||
if (title) { | ||
cellTitle = _utils2.default.isFunction(title) ? title(content, row, rowIndex, columnIndex) : content; | ||
cellAttrs.title = cellTitle; | ||
} | ||
if (formatter) { | ||
@@ -114,17 +105,11 @@ content = column.formatter(content, row, rowIndex, formatExtraData); | ||
if (align) { | ||
cellStyle.textAlign = _utils2.default.isFunction(align) ? align(content, row, rowIndex, columnIndex) : align; | ||
} | ||
if (cellClasses) cellAttrs.className = cellClasses; | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
if (clickToEdit && editable) { | ||
cellAttrs.onClick = this.handleEditingCell; | ||
attrs.onClick = this.handleEditingCell; | ||
} else if (dbclickToEdit && editable) { | ||
cellAttrs.onDoubleClick = this.handleEditingCell; | ||
attrs.onDoubleClick = this.handleEditingCell; | ||
} | ||
return _react2.default.createElement( | ||
'td', | ||
cellAttrs, | ||
attrs, | ||
typeof content === 'boolean' ? '' + content : content | ||
@@ -131,0 +116,0 @@ ); |
@@ -143,3 +143,27 @@ 'use strict'; | ||
} | ||
return _react2.default.createElement(_cell2.default, { | ||
// render cell | ||
var cellTitle = void 0; | ||
var cellStyle = {}; | ||
var cellAttrs = _extends({}, _utils2.default.isFunction(column.attrs) ? column.attrs(content, row, rowIndex, index) : column.attrs, column.events); | ||
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.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 (cellClasses) cellAttrs.className = cellClasses; | ||
if (!_utils2.default.isEmptyObject(cellStyle)) cellAttrs.style = cellStyle; | ||
return _react2.default.createElement(_cell2.default, _extends({ | ||
key: content + '-' + index, | ||
@@ -154,3 +178,3 @@ row: row, | ||
dbclickToEdit: mode === DBCLICK_TO_CELL_EDIT | ||
}); | ||
}, cellAttrs)); | ||
} | ||
@@ -157,0 +181,0 @@ return false; |
@@ -7,12 +7,15 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _underscore = require('underscore'); | ||
/* eslint no-empty: 0 */ | ||
/* eslint no-param-reassign: 0 */ | ||
/* eslint prefer-rest-params: 0 */ | ||
var _underscore2 = _interopRequireDefault(_underscore); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function splitNested(str) { | ||
return [str].join('.').replace(/\[/g, '.').replace(/\]/g, '').split('.'); | ||
} | ||
} /* eslint no-empty: 0 */ | ||
/* eslint no-param-reassign: 0 */ | ||
/* eslint prefer-rest-params: 0 */ | ||
function get(target, field) { | ||
@@ -50,18 +53,4 @@ var pathArray = splitNested(field); | ||
function isFunction(obj) { | ||
return obj && typeof obj === 'function'; | ||
} | ||
/** | ||
* Checks if `value` is the Object. the `Object` except `Function` and `Array.` | ||
* | ||
* @param {*} obj - The value gonna check | ||
*/ | ||
function isObject(obj) { | ||
var type = typeof obj === 'undefined' ? 'undefined' : _typeof(obj); | ||
return obj !== null && type === 'object' && obj.constructor === Object; | ||
} | ||
function isEmptyObject(obj) { | ||
if (!isObject(obj)) return false; | ||
if (!_underscore2.default.isObject(obj)) return false; | ||
@@ -109,3 +98,3 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
if (callNow) { | ||
func.appy(_this, _arguments); | ||
func.apply(_this, _arguments); | ||
} | ||
@@ -115,11 +104,2 @@ }; | ||
exports.default = { | ||
get: get, | ||
set: set, | ||
isFunction: isFunction, | ||
isObject: isObject, | ||
isEmptyObject: isEmptyObject, | ||
isDefined: isDefined, | ||
sleep: sleep, | ||
debounce: debounce | ||
}; | ||
exports.default = Object.assign(_underscore2.default, { get: get, set: set, isDefined: isDefined, isEmptyObject: isEmptyObject, sleep: sleep, debounce: debounce }); |
{ | ||
"name": "react-bootstrap-table-next", | ||
"version": "1.0.0", | ||
"version": "1.1.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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances 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
727541
8587
6