New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fast-table

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-table - npm Package Compare versions

Comparing version 1.4.6 to 1.4.7-beta.0

411

lib/AutoSizer.js

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,328 +8,169 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _detectElementResize = _interopRequireDefault(
require('./utils/detectElementResize')
);
var _detectElementResize = _interopRequireDefault(require("./utils/detectElementResize"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var AutoSizer =
/*#__PURE__*/
(function(_React$PureComponent) {
_inherits(AutoSizer, _React$PureComponent);
/*#__PURE__*/
function (_React$PureComponent) {
_inherits(AutoSizer, _React$PureComponent);
function AutoSizer() {
var _getPrototypeOf2;
function AutoSizer() {
var _getPrototypeOf2;
var _this;
var _this;
_classCallCheck(this, AutoSizer);
_classCallCheck(this, AutoSizer);
for (
var _len = arguments.length, args = new Array(_len), _key = 0;
_key < _len;
_key++
) {
args[_key] = arguments[_key];
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(
this,
(_getPrototypeOf2 = _getPrototypeOf(AutoSizer)).call.apply(
_getPrototypeOf2,
[this].concat(args)
)
);
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(AutoSizer)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'state',
{
height: _this.props.defaultHeight || 0,
width: _this.props.defaultWidth || 0
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
height: _this.props.defaultHeight || 0,
width: _this.props.defaultWidth || 0
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_parentNode',
void 0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_parentNode", void 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_autoSizer',
void 0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_autoSizer", void 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_detectElementResize',
void 0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_detectElementResize", void 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_onResize',
function() {
var _this$props = _this.props,
disableHeight = _this$props.disableHeight,
disableWidth = _this$props.disableWidth,
onResize = _this$props.onResize;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_onResize", function () {
var _this$props = _this.props,
disableHeight = _this$props.disableHeight,
disableWidth = _this$props.disableWidth,
onResize = _this$props.onResize;
if (_this._parentNode) {
var height = _this._parentNode.offsetHeight || 0;
var width = _this._parentNode.offsetWidth || 0;
var style = window.getComputedStyle(_this._parentNode) || {};
var paddingLeft = parseInt(style.paddingLeft, 10) || 0;
var paddingRight = parseInt(style.paddingRight, 10) || 0;
var paddingTop = parseInt(style.paddingTop, 10) || 0;
var paddingBottom = parseInt(style.paddingBottom, 10) || 0;
var borderLeftWidth = parseInt(style.borderLeftWidth, 10) || 0;
var borderTopWidth = parseInt(style.borderTopWidth, 10) || 0;
var borderRightWidth = parseInt(style.borderRightWidth, 10) || 0;
var borderBottomWidth = parseInt(style.borderBottomWidth, 10) || 0;
var newHeight = height - paddingTop - paddingBottom;
var newWidth = width - paddingLeft - paddingRight;
if (_this._parentNode) {
var height = _this._parentNode.offsetHeight || 0;
var width = _this._parentNode.offsetWidth || 0;
var style = window.getComputedStyle(_this._parentNode) || {};
var paddingLeft = parseInt(style.paddingLeft, 10) || 0;
var paddingRight = parseInt(style.paddingRight, 10) || 0;
var paddingTop = parseInt(style.paddingTop, 10) || 0;
var paddingBottom = parseInt(style.paddingBottom, 10) || 0;
var borderLeftWidth = parseInt(style.borderLeftWidth, 10) || 0;
var borderTopWidth = parseInt(style.borderTopWidth, 10) || 0;
var borderRightWidth = parseInt(style.borderRightWidth, 10) || 0;
var borderBottomWidth = parseInt(style.borderBottomWidth, 10) || 0;
var newHeight = height - paddingTop - paddingBottom;
var newWidth = width - paddingLeft - paddingRight;
if (style.boxSizing === 'border-box') {
newHeight = newHeight - borderTopWidth - borderBottomWidth;
newWidth = newWidth - borderLeftWidth - borderRightWidth;
}
if (style.boxSizing === 'border-box') {
newHeight = newHeight - borderTopWidth - borderBottomWidth;
newWidth = newWidth - borderLeftWidth - borderRightWidth;
}
if (
(!disableHeight && _this.state.height !== newHeight) ||
(!disableWidth && _this.state.width !== newWidth)
) {
var state = {
height: newHeight,
width: newWidth
};
if (!disableHeight && _this.state.height !== newHeight || !disableWidth && _this.state.width !== newWidth) {
var state = {
height: newHeight,
width: newWidth
};
_this.setState(state);
_this.setState(state);
onResize(state);
}
}
onResize(state);
}
);
}
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_setRef',
function(autoSizer) {
_this._autoSizer = autoSizer;
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_setRef", function (autoSizer) {
_this._autoSizer = autoSizer;
});
return _this;
}
return _this;
}
_createClass(AutoSizer, [
{
key: 'componentDidMount',
value: function componentDidMount() {
var nonce = this.props.nonce;
_createClass(AutoSizer, [{
key: "componentDidMount",
value: function componentDidMount() {
var nonce = this.props.nonce;
if (
this._autoSizer &&
this._autoSizer.parentNode &&
this._autoSizer.parentNode.ownerDocument &&
this._autoSizer.parentNode.ownerDocument.defaultView &&
this._autoSizer.parentNode instanceof
this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement
) {
this._parentNode = this._autoSizer.parentNode;
this._detectElementResize = (0, _detectElementResize.default)(
nonce
);
if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
this._parentNode = this._autoSizer.parentNode;
this._detectElementResize = (0, _detectElementResize.default)(nonce);
this._detectElementResize.addResizeListener(
this._parentNode,
this._onResize
);
this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
this._onResize();
}
}
},
{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
if (this._detectElementResize && this._parentNode) {
this._detectElementResize.removeResizeListener(
this._parentNode,
this._onResize
);
}
}
},
{
key: 'render',
value: function render() {
var _this$props2 = this.props,
children = _this$props2.children,
className = _this$props2.className,
disableHeight = _this$props2.disableHeight,
disableWidth = _this$props2.disableWidth,
style = _this$props2.style;
var _this$state = this.state,
height = _this$state.height,
width = _this$state.width;
var outerStyle = {
overflow: 'visible'
};
var childParams = {};
this._onResize();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this._detectElementResize && this._parentNode) {
this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
}
}
}, {
key: "render",
value: function render() {
var _this$props2 = this.props,
children = _this$props2.children,
className = _this$props2.className,
disableHeight = _this$props2.disableHeight,
disableWidth = _this$props2.disableWidth,
style = _this$props2.style;
var _this$state = this.state,
height = _this$state.height,
width = _this$state.width;
var outerStyle = {
overflow: 'visible'
};
var childParams = {};
if (!disableHeight) {
outerStyle.height = 0;
childParams.height = height;
}
if (!disableHeight) {
outerStyle.height = 0;
childParams.height = height;
}
if (!disableWidth) {
outerStyle.width = 0;
childParams.width = width;
}
return _react.default.createElement(
'div',
{
className: className,
ref: this._setRef,
style: _objectSpread({}, outerStyle, style, {
height: '100%'
})
},
children(childParams)
);
}
if (!disableWidth) {
outerStyle.width = 0;
childParams.width = width;
}
]);
return AutoSizer;
})(_react.default.PureComponent);
return _react.default.createElement("div", {
className: className,
ref: this._setRef,
style: _objectSpread({}, outerStyle, style, {
height: '100%'
})
}, children(childParams));
}
}]);
return AutoSizer;
}(_react.default.PureComponent);
exports.default = AutoSizer;
_defineProperty(AutoSizer, 'defaultProps', {
_defineProperty(AutoSizer, "defaultProps", {
onResize: function onResize() {},

@@ -339,2 +180,2 @@ disableHeight: false,

style: {}
});
});

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,660 +8,433 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _TableHeader = _interopRequireDefault(require('./TableHeader'));
var _TableHeader = _interopRequireDefault(require("./TableHeader"));
var _TableRow = _interopRequireDefault(require('./TableRow'));
var _TableRow = _interopRequireDefault(require("./TableRow"));
var _miniStore = require('./mini-store');
var _miniStore = require("./mini-store");
var _ExpandedIcon = _interopRequireDefault(require('./ExpandedIcon'));
var _ExpandedIcon = _interopRequireDefault(require("./ExpandedIcon"));
var _TableCell = _interopRequireDefault(require('./TableCell'));
var _TableCell = _interopRequireDefault(require("./TableCell"));
var _types = require('./types');
var _types = require("./types");
var _utils = require('./utils');
var _utils = require("./utils");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var BaseTable =
/*#__PURE__*/
(function(_React$PureComponent) {
_inherits(BaseTable, _React$PureComponent);
/*#__PURE__*/
function (_React$PureComponent) {
_inherits(BaseTable, _React$PureComponent);
function BaseTable() {
var _getPrototypeOf2;
function BaseTable() {
var _getPrototypeOf2;
var _this;
var _this;
_classCallCheck(this, BaseTable);
_classCallCheck(this, BaseTable);
for (
var _len = arguments.length, args = new Array(_len), _key = 0;
_key < _len;
_key++
) {
args[_key] = arguments[_key];
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(
this,
(_getPrototypeOf2 = _getPrototypeOf(BaseTable)).call.apply(
_getPrototypeOf2,
[this].concat(args)
)
);
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(BaseTable)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_children',
[]
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_children", []);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_startIndex',
0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_startIndex", 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_stopIndex',
0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_stopIndex", 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_forceCount',
0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_forceCount", 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fExpanded',
function(event) {
event.stopPropagation();
var expandChange = _this.context.expandChange;
expandChange(event.currentTarget.getAttribute('data-key'));
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fExpanded", function (event) {
event.stopPropagation();
var expandChange = _this.context.expandChange;
expandChange(event.currentTarget.getAttribute('data-key'));
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fSort',
function(key, order) {
var sortManager = _this.context.manager.sortManager;
var onSort = _this.context.props.onSort;
sortManager.setOrder(key, order, function(orders) {
_this.props.store.setState({
orders: orders
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fSort", function (key, order) {
var sortManager = _this.context.manager.sortManager;
var onSort = _this.context.props.onSort;
sortManager.setOrder(key, order, function (orders) {
_this.props.store.setState({
orders: orders
});
if (typeof onSort === 'function') {
onSort(orders);
}
});
if (typeof onSort === 'function') {
onSort(orders);
}
);
});
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getRowData',
function(event) {
var key = event.currentTarget.getAttribute('data-key');
var dataManager = _this.context.manager.dataManager;
return dataManager.getByKey(key);
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getRowData", function (event) {
var key = event.currentTarget.getAttribute('data-key');
var dataManager = _this.context.manager.dataManager;
return dataManager.getByKey(key);
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fEvents',
function(event) {
var record = _this.getRowData(event);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fEvents", function (event) {
var record = _this.getRowData(event);
var expandChange = _this.context.expandChange;
var _this$context$props = _this.context.props,
expandedRowByClick = _this$context$props.expandedRowByClick,
onRow = _this$context$props.onRow;
var events = onRow(record) || {};
var func = _types.eventsMap[event.type];
var expandChange = _this.context.expandChange;
var _this$context$props = _this.context.props,
expandedRowByClick = _this$context$props.expandedRowByClick,
onRow = _this$context$props.onRow;
var events = onRow(record) || {};
var func = _types.eventsMap[event.type];
if (
(0, _utils.has)(events, func) &&
typeof events[func] === 'function'
) {
events[func](event);
}
if ((0, _utils.has)(events, func) && typeof events[func] === 'function') {
events[func](event);
}
if (event.type === 'click') {
expandedRowByClick &&
record[_types.DS._expandedEnable] &&
expandChange(record[_types.DS._key]);
} else if (event.type === 'mouseenter') {
_this.fHover(true, record[_types.DS._key]);
} else if (event.type === 'mouseleave') {
_this.fHover(false, record[_types.DS._key]);
}
}
);
if (event.type === 'click') {
expandedRowByClick && record[_types.DS._expandedEnable] && expandChange(record[_types.DS._key]);
} else if (event.type === 'mouseenter') {
_this.fHover(true, record[_types.DS._key]);
} else if (event.type === 'mouseleave') {
_this.fHover(false, record[_types.DS._key]);
}
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fHover',
function(isHover, key) {
var hoverEnable = _this.context.props.hoverEnable;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fHover", function (isHover, key) {
var hoverEnable = _this.context.props.hoverEnable;
if (hoverEnable) {
_this.props.store.setState({
currentHoverKey: isHover ? key : null
});
}
}
);
if (hoverEnable) {
_this.props.store.setState({
currentHoverKey: isHover ? key : null
});
}
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fDrag',
function(parent, columns) {
var update = _this.context.update;
var onHeaderSortable = _this.context.props.onHeaderSortable;
var columnManager = _this.context.manager.columnManager;
columnManager.updateGroupedColumns(
_this.updateColumn(columnManager.groupedColumns(), parent, columns)
);
_this._forceCount += 1;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fDrag", function (parent, columns) {
var update = _this.context.update;
var onHeaderSortable = _this.context.props.onHeaderSortable;
var columnManager = _this.context.manager.columnManager;
columnManager.updateGroupedColumns(_this.updateColumn(columnManager.groupedColumns(), parent, columns));
_this._forceCount += 1;
if (typeof update === 'function') {
update();
}
if (typeof update === 'function') {
update();
}
if (typeof onHeaderSortable === 'function') {
onHeaderSortable(columnManager.groupedColumns());
}
if (typeof onHeaderSortable === 'function') {
onHeaderSortable(columnManager.groupedColumns());
}
_this.forceUpdate();
}
);
_this.forceUpdate();
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'updateColumn',
function(columns, parent, newColumns) {
columns = columns || [];
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateColumn", function (columns, parent, newColumns) {
columns = columns || [];
if (!parent) {
return newColumns;
}
if (!parent) {
return newColumns;
}
return columns.map(function(column) {
if (column[_types.CS._pathKey] === parent[_types.CS._pathKey]) {
column = _objectSpread({}, column, {
children: newColumns
});
} else {
if (column.children && column.children.length > 0) {
return _objectSpread({}, column, {
children: _this.updateColumn(
column.children,
parent,
newColumns
)
});
}
}
return column;
return columns.map(function (column) {
if (column[_types.CS._pathKey] === parent[_types.CS._pathKey]) {
column = _objectSpread({}, column, {
children: newColumns
});
} else {
if (column.children && column.children.length > 0) {
return _objectSpread({}, column, {
children: _this.updateColumn(column.children, parent, newColumns)
});
}
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getCellStyle',
function(column, record) {
var onCell = column.onCell;
var align = column.align || 'left';
var width = column[_types.CS._width];
return column;
});
});
var style = _objectSpread({}, (0, _utils.cellAlignStyle)(align));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getCellStyle", function (column, record) {
var onCell = column.onCell;
var align = column.align || 'left';
var width = column[_types.CS._width];
if (width) {
style.width = width;
style.minWidth = width;
}
var style = _objectSpread({}, (0, _utils.cellAlignStyle)(align));
if (onCell) {
style = _objectSpread({}, style, onCell(column, record));
}
if (width) {
style.width = width;
style.minWidth = width;
}
return style;
}
);
if (onCell) {
style = _objectSpread({}, style, onCell(column, record));
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getCellText',
function(column, record) {
var render = column.render,
dataIndex = column.dataIndex;
var text = (record || {})[dataIndex];
return style;
});
if (typeof render === 'function') {
text = render(text, record);
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getCellText", function (column, record) {
var render = column.render,
dataIndex = column.dataIndex;
var text = (record || {})[dataIndex];
if ((0, _utils.isInvalidRenderCellText)(text)) {
text = null;
}
if (typeof render === 'function') {
text = render(text, record);
}
return text;
}
);
if ((0, _utils.isInvalidRenderCellText)(text)) {
text = null;
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'recomputeBody',
function(_ref) {
var startIndex = _ref.startIndex,
stopIndex = _ref.stopIndex;
_this._startIndex = startIndex;
_this._stopIndex = stopIndex;
return text;
});
_this.forceUpdate();
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "recomputeBody", function (_ref) {
var startIndex = _ref.startIndex,
stopIndex = _ref.stopIndex;
_this._startIndex = startIndex;
_this._stopIndex = stopIndex;
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getRowStyle',
function(record, key) {
var _this$context$manager = _this.context.manager,
sizeManager = _this$context$manager.sizeManager,
cacheManager = _this$context$manager.cacheManager,
dataManager = _this$context$manager.dataManager;
var rowStyle = cacheManager.getRowStyle(key);
_this.forceUpdate();
});
if (!rowStyle || dataManager.isFixed(record)) {
rowStyle = {
position: 'absolute',
top: record[_types.DS._top],
height: record[_types.DS._height]
};
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getRowStyle", function (record, key) {
var _this$context$manager = _this.context.manager,
sizeManager = _this$context$manager.sizeManager,
cacheManager = _this$context$manager.cacheManager,
dataManager = _this$context$manager.dataManager;
var rowStyle = cacheManager.getRowStyle(key);
if (
record[_types.DS._isFixed] === true ||
record[_types.DS._isFixed] === 'top'
) {
rowStyle.top += sizeManager._scrollTop;
rowStyle.zIndex = 1;
} else if (record[_types.DS._isFixed] === 'bottom') {
rowStyle.top -=
sizeManager._dataHeight +
sizeManager.scrollSizeX() -
sizeManager._scrollTop -
sizeManager._clientBodyHeight;
rowStyle.zIndex = 1;
}
if (!rowStyle || dataManager.isFixed(record)) {
rowStyle = {
position: 'absolute',
top: record[_types.DS._top],
height: record[_types.DS._height]
};
if (!record[_types.DS._isFixed]) {
cacheManager.setRowStyle(key, rowStyle);
}
}
if (record[_types.DS._isFixed] === true || record[_types.DS._isFixed] === 'top') {
rowStyle.top += sizeManager._scrollTop;
rowStyle.zIndex = 1;
} else if (record[_types.DS._isFixed] === 'bottom') {
rowStyle.top -= sizeManager._dataHeight + sizeManager.scrollSizeX() - sizeManager._scrollTop - sizeManager._clientBodyHeight;
rowStyle.zIndex = 1;
}
return rowStyle;
if (!record[_types.DS._isFixed]) {
cacheManager.setRowStyle(key, rowStyle);
}
);
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderCells',
function(props, record) {
var fixed = props.fixed;
var _this$context$props2 = _this.context.props,
prefixCls = _this$context$props2.prefixCls,
indentSize = _this$context$props2.indentSize;
var _this$context$manager2 = _this.context.manager,
dataManager = _this$context$manager2.dataManager,
cacheManager = _this$context$manager2.cacheManager,
columnManager = _this$context$manager2.columnManager;
var columns = columnManager.bodyColumns(fixed);
var hasExpanded = dataManager._hasExpanded;
var cells = [];
return rowStyle;
});
for (var i = 0; i < columns.length; i++) {
var cellKey = 'Row['
.concat(record[_types.DS._path], ']-Col[')
.concat(columns[i][_types.CS._pathKey], ']-')
.concat(i, '_')
.concat(fixed || '', '-')
.concat(_this._forceCount);
var cell = cacheManager.getCell(cellKey);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderCells", function (props, record) {
var fixed = props.fixed;
var _this$context$props2 = _this.context.props,
prefixCls = _this$context$props2.prefixCls,
indentSize = _this$context$props2.indentSize;
var _this$context$manager2 = _this.context.manager,
dataManager = _this$context$manager2.dataManager,
cacheManager = _this$context$manager2.cacheManager,
columnManager = _this$context$manager2.columnManager;
var columns = columnManager.bodyColumns(fixed);
var hasExpanded = dataManager._hasExpanded;
var cells = [];
if (!cell || record[_types.DS._isFixed]) {
var cellProps = {
key: cellKey,
className: columns[i].className,
style: _this.getCellStyle(columns[i], record),
children: _this.getCellText(columns[i], record)
};
for (var i = 0; i < columns.length; i++) {
var cellKey = "Row[".concat(record[_types.DS._path], "]-Col[").concat(columns[i][_types.CS._pathKey], "]-").concat(i, "_").concat(fixed || '', "-").concat(_this._forceCount);
var cell = cacheManager.getCell(cellKey);
if (hasExpanded && fixed !== 'right' && i === 0) {
cellProps.ExpandedIcon = (0, _ExpandedIcon.default)({
prefixCls: prefixCls,
indentSize: indentSize,
record: record,
onClick: _this.fExpanded
});
}
if (!cell || record[_types.DS._isFixed]) {
var cellProps = {
key: cellKey,
className: columns[i].className,
style: _this.getCellStyle(columns[i], record),
children: _this.getCellText(columns[i], record)
};
cacheManager.setCell(cellKey, (0, _TableCell.default)(cellProps));
cell = cacheManager.getCell(cellKey);
}
cells.push(cell);
if (hasExpanded && fixed !== 'right' && i === 0) {
cellProps.ExpandedIcon = (0, _ExpandedIcon.default)({
prefixCls: prefixCls,
indentSize: indentSize,
record: record,
onClick: _this.fExpanded
});
}
return cells;
cacheManager.setCell(cellKey, (0, _TableCell.default)(cellProps));
cell = cacheManager.getCell(cellKey);
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderRowChildren',
function(props, record) {
var expandedRowRender = _this.context.props.expandedRowRender;
cells.push(cell);
}
if (expandedRowRender && record[_types.DS._expandedLevel] > 0) {
return expandedRowRender(
record,
props.fixed,
record[_types.DS._expandedLevel]
);
} else {
return _this.renderCells(props, record);
}
}
);
return cells;
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderRows',
function(props) {
var rows = [];
var fixed = props.fixed,
currentHoverKey = props.currentHoverKey;
var _this$context$props3 = _this.context.props,
prefixCls = _this$context$props3.prefixCls,
onRow = _this$context$props3.onRow;
var dataManager = _this.context.manager.dataManager;
var showData = dataManager.showData();
var dataSource = showData.filter(function(d, index) {
return (
(index >= _this._startIndex && index <= _this._stopIndex) ||
dataManager.isFixed(d)
);
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderRowChildren", function (props, record) {
var expandedRowRender = _this.context.props.expandedRowRender;
var _loop = function _loop(index) {
var record = dataSource[index];
if (expandedRowRender && record[_types.DS._expandedLevel] > 0) {
return expandedRowRender(record, props.fixed, record[_types.DS._expandedLevel]);
} else {
return _this.renderCells(props, record);
}
});
var cells = _this.renderRowChildren(props, record);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderRows", function (props) {
var rows = [];
var fixed = props.fixed,
currentHoverKey = props.currentHoverKey;
var _this$context$props3 = _this.context.props,
prefixCls = _this$context$props3.prefixCls,
onRow = _this$context$props3.onRow;
var dataManager = _this.context.manager.dataManager;
var showData = dataManager.showData();
var dataSource = showData.filter(function (d, index) {
return index >= _this._startIndex && index <= _this._stopIndex || dataManager.isFixed(d);
});
var key = 'Row_'
.concat(fixed || '', '_')
.concat(record[_types.DS._path], '_')
.concat(_this._forceCount);
var rowProps = {
key: key,
prefixCls: prefixCls,
cells: cells,
record: record,
hovered: currentHoverKey === record[_types.DS._key],
style: _this.getRowStyle(record, key),
children: cells
};
(0, _utils.keys)(onRow(record) || {}).forEach(function(event) {
return (rowProps[event] = _this.fEvents);
});
var _loop = function _loop(index) {
var record = dataSource[index];
if (!(0, _utils.has)(onRow(record), 'onClick')) {
rowProps['onClick'] = _this.fEvents;
}
var cells = _this.renderRowChildren(props, record);
rows.push((0, _TableRow.default)(rowProps));
};
var key = "Row_".concat(fixed || '', "_").concat(record[_types.DS._path], "_").concat(_this._forceCount);
var rowProps = {
key: key,
prefixCls: prefixCls,
cells: cells,
record: record,
hovered: currentHoverKey === record[_types.DS._key],
style: _this.getRowStyle(record, key),
children: cells
};
(0, _utils.keys)(onRow(record) || {}).forEach(function (event) {
return rowProps[event] = _this.fEvents;
});
for (var index = 0; index < dataSource.length; index++) {
_loop(index);
}
_this._children = rows;
return _this._children;
if (!(0, _utils.has)(onRow(record), 'onClick')) {
rowProps['onClick'] = _this.fEvents;
}
);
return _this;
}
rows.push((0, _TableRow.default)(rowProps));
};
_createClass(BaseTable, [
{
key: 'componentWillMount',
value: function componentWillMount() {
this._forceCount = 0;
var _this$props = this.props,
registerForce = _this$props.registerForce,
fixed = _this$props.fixed;
var sizeManager = this.context.manager.sizeManager;
for (var index = 0; index < dataSource.length; index++) {
_loop(index);
}
if (registerForce) {
registerForce(fixed, this.recomputeBody);
}
_this._children = rows;
return _this._children;
});
this._startIndex = sizeManager._startIndex;
this._stopIndex = sizeManager._stopIndex;
this.renderRows(this.props);
}
},
{
key: 'componentWillUpdate',
value: function componentWillUpdate(nextProps, nextState, nextContext) {
var hasBody = nextProps.hasBody;
return _this;
}
if (hasBody) {
this.renderRows(nextProps);
}
}
},
{
key: 'render',
value: function render() {
var _this$props2 = this.props,
hasHead = _this$props2.hasHead,
hasBody = _this$props2.hasBody,
fixed = _this$props2.fixed,
orders = _this$props2.orders;
var _this$context$manager3 = this.context.manager,
columnManager = _this$context$manager3.columnManager,
sizeManager = _this$context$manager3.sizeManager;
var _this$context$props4 = this.context.props,
prefixCls = _this$context$props4.prefixCls,
headerRowHeight = _this$context$props4.headerRowHeight,
rowHeight = _this$context$props4.rowHeight,
onHeaderRow = _this$context$props4.onHeaderRow;
var body;
_createClass(BaseTable, [{
key: "componentWillMount",
value: function componentWillMount() {
this._forceCount = 0;
var _this$props = this.props,
registerForce = _this$props.registerForce,
fixed = _this$props.fixed;
var sizeManager = this.context.manager.sizeManager;
if (hasBody) {
body = _react.default.createElement(
'div',
{
className: 'tbody',
style: {
height: sizeManager._dataHeight,
minHeight: rowHeight
}
},
this._children
);
}
if (registerForce) {
registerForce(fixed, this.recomputeBody);
}
var width = columnManager.getWidth(fixed) || '100%';
var style = {
width: width
};
this._startIndex = sizeManager._startIndex;
this._stopIndex = sizeManager._stopIndex;
this.renderRows(this.props);
}
}, {
key: "componentWillUpdate",
value: function componentWillUpdate(nextProps, nextState, nextContext) {
var hasBody = nextProps.hasBody;
if (!fixed) {
style.minWidth = '100%';
if (hasBody) {
this.renderRows(nextProps);
}
}
}, {
key: "render",
value: function render() {
var _this$props2 = this.props,
hasHead = _this$props2.hasHead,
hasBody = _this$props2.hasBody,
fixed = _this$props2.fixed,
orders = _this$props2.orders;
var _this$context$manager3 = this.context.manager,
columnManager = _this$context$manager3.columnManager,
sizeManager = _this$context$manager3.sizeManager;
var _this$context$props4 = this.context.props,
prefixCls = _this$context$props4.prefixCls,
headerRowHeight = _this$context$props4.headerRowHeight,
rowHeight = _this$context$props4.rowHeight,
onHeaderRow = _this$context$props4.onHeaderRow;
var body;
if (hasBody) {
body = _react.default.createElement("div", {
className: "tbody",
style: {
height: sizeManager._dataHeight,
minHeight: rowHeight
}
}, this._children);
}
var header =
hasHead &&
(0, _TableHeader.default)({
columns: columnManager.headColumns(fixed),
fixed: fixed,
onSort: this.fSort,
orders: orders,
prefixCls: prefixCls,
headerRowHeight: headerRowHeight,
onHeaderRow: onHeaderRow,
onDrag: this.fDrag
});
return _react.default.createElement(
'div',
{
className: 'table',
style: style
},
header,
body
);
}
var width = columnManager.getWidth(fixed) || '100%';
var style = {
width: width
};
if (!fixed) {
style.minWidth = '100%';
}
]);
return BaseTable;
})(_react.default.PureComponent);
var header = hasHead && (0, _TableHeader.default)({
columns: columnManager.headColumns(fixed),
fixed: fixed,
onSort: this.fSort,
orders: orders,
prefixCls: prefixCls,
headerRowHeight: headerRowHeight,
onHeaderRow: onHeaderRow,
onDrag: this.fDrag
});
return _react.default.createElement("div", {
className: "table",
style: style
}, header, body);
}
}]);
_defineProperty(BaseTable, 'contextTypes', {
return BaseTable;
}(_react.default.PureComponent);
_defineProperty(BaseTable, "contextTypes", {
props: _propTypes.default.object,

@@ -673,5 +446,5 @@ manager: _propTypes.default.object,

var _default = (0, _miniStore.connect)(function(state) {
var _default = (0, _miniStore.connect)(function (state) {
var currentHoverKey = state.currentHoverKey,
orders = state.orders;
orders = state.orders;
return {

@@ -683,2 +456,2 @@ currentHoverKey: currentHoverKey,

exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,58 +8,28 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _BaseTable = _interopRequireDefault(require('./BaseTable'));
var _BaseTable = _interopRequireDefault(require("./BaseTable"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function BodyTable(props, _ref) {
var manager = _ref.manager,
baseProps = _ref.props;
baseProps = _ref.props;
var columnManager = manager.columnManager,
sizeManager = manager.sizeManager;
sizeManager = manager.sizeManager;
var prefixCls = baseProps.prefixCls,
fixedHeader = baseProps.fixedHeader,
showHeader = baseProps.showHeader,
dataSource = baseProps.dataSource,
bodyMaxHeight = baseProps.bodyMaxHeight;
fixedHeader = baseProps.fixedHeader,
showHeader = baseProps.showHeader,
dataSource = baseProps.dataSource,
bodyMaxHeight = baseProps.bodyMaxHeight;
var saveRef = props.saveRef,
fixed = props.fixed,
handleBodyScroll = props.handleBodyScroll,
registerForce = props.registerForce;
fixed = props.fixed,
handleBodyScroll = props.handleBodyScroll,
registerForce = props.registerForce;

@@ -78,4 +48,3 @@ var baseTable = _react.default.createElement(_BaseTable.default, {

height = sizeManager._wrapperHeight - sizeManager.footerHeight;
height =
height - (showHeader && fixedHeader ? sizeManager._headerHeight : 0);
height = height - (showHeader && fixedHeader ? sizeManager._headerHeight : 0);
}

@@ -103,3 +72,3 @@

if (scrollSize > 0 && fixed) {
style.marginBottom = '-'.concat(scrollSize, 'px');
style.marginBottom = "-".concat(scrollSize, "px");
style.paddingBottom = '0px';

@@ -120,37 +89,25 @@ }

fixed === 'left' && (style.width = columnManager.getWidth(fixed));
return _react.default.createElement(
'div',
{
key: 'bodyTable',
className: ''.concat(prefixCls, '-body-outer'),
style: _objectSpread({}, style)
return _react.default.createElement("div", {
key: "bodyTable",
className: "".concat(prefixCls, "-body-outer"),
style: _objectSpread({}, style)
}, _react.default.createElement("div", {
className: "".concat(prefixCls, "-body-inner"),
ref: saveRef(scrollRef),
style: {
height: '100%',
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden',
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden'
},
_react.default.createElement(
'div',
{
className: ''.concat(prefixCls, '-body-inner'),
ref: saveRef(scrollRef),
style: {
height: '100%',
overflowY: sizeManager._hasScrollY ? 'scroll' : 'hidden',
overflowX: sizeManager._hasScrollX ? 'scroll' : 'hidden'
},
onScroll: handleBodyScroll
},
baseTable
)
);
onScroll: handleBodyScroll
}, baseTable));
}
return _react.default.createElement(
'div',
{
key: 'bodyTable',
className: ''.concat(prefixCls, '-body'),
ref: saveRef(scrollRef),
style: style,
onScroll: handleBodyScroll
},
baseTable
);
return _react.default.createElement("div", {
key: "bodyTable",
className: "".concat(prefixCls, "-body"),
ref: saveRef(scrollRef),
style: style,
onScroll: handleBodyScroll
}, baseTable);
}

@@ -163,2 +120,2 @@

manager: _propTypes.default.object
};
};

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,122 +8,37 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
var _types = require('./types');
var _types = require("./types");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectDestructuringEmpty(obj) {
if (obj == null) throw new TypeError('Cannot destructure undefined');
}
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
function _extends() {
_extends =
Object.assign ||
function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function ExpandedIcon(props) {
var prefixCls = props.prefixCls,
record = props.record,
expanded = props.expanded,
other = _objectWithoutProperties(props, [
'prefixCls',
'record',
'expanded'
]);
record = props.record,
expanded = props.expanded,
other = _objectWithoutProperties(props, ["prefixCls", "record", "expanded"]);
var newProps = _objectSpread(
{
className: (0, _classnames.default)(
''.concat(prefixCls, '-expanded-icon'),
{
expanded: expanded
}
)
},
other
);
var newProps = _objectSpread({
className: (0, _classnames.default)("".concat(prefixCls, "-expanded-icon"), {
expanded: expanded
})
}, other);
return _react.default.createElement(
'span',
_extends({}, newProps, {
'data-key': record[_types.DS._key]
})
);
return _react.default.createElement("span", _extends({}, newProps, {
"data-key": record[_types.DS._key]
}));
}

@@ -133,5 +48,5 @@

var prefixCls = props.prefixCls,
indentSize = props.indentSize,
record = props.record,
onClick = props.onClick;
indentSize = props.indentSize,
record = props.record,
onClick = props.onClick;

@@ -156,25 +71,19 @@ var _ref = record || [];

return _react.default.createElement(
'div',
{
style: {
display: 'inline-flex',
flexDirection: 'row',
justifyContent: 'flex-start'
}
},
_react.default.createElement('span', {
style: {
width: expandedLevel * indentSize,
display: 'inline-block'
}
}),
icon ||
_react.default.createElement('span', {
style: {
width: indentSize,
display: 'inline-block'
}
})
);
}
return _react.default.createElement("div", {
style: {
display: 'inline-flex',
flexDirection: 'row',
justifyContent: 'flex-start'
}
}, _react.default.createElement("span", {
style: {
width: expandedLevel * indentSize,
display: 'inline-block'
}
}), icon || _react.default.createElement("span", {
style: {
width: indentSize,
display: 'inline-block'
}
}));
}

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,68 +8,38 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require('./utils');
var _utils = require("./utils");
var _Sorter = _interopRequireDefault(require('./Sorter'));
var _Sorter = _interopRequireDefault(require("./Sorter"));
var _types = require('./types');
var _types = require("./types");
var _Sortable = _interopRequireDefault(require('./Sortable'));
var _Sortable = _interopRequireDefault(require("./Sortable"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function HeadCell(props) {
var key = props.key,
column = props.column,
_props$current = props.current,
current = _props$current === void 0 ? 0 : _props$current,
prefixCls = props.prefixCls,
headerRowHeight = props.headerRowHeight,
orders = props.orders,
onSort = props.onSort,
fixed = props.fixed,
onHeaderRow = props.onHeaderRow,
onDrag = props.onDrag;
column = props.column,
_props$current = props.current,
current = _props$current === void 0 ? 0 : _props$current,
prefixCls = props.prefixCls,
headerRowHeight = props.headerRowHeight,
orders = props.orders,
onSort = props.onSort,
fixed = props.fixed,
onHeaderRow = props.onHeaderRow,
onDrag = props.onDrag;
var children = column.children || [];
var dataIndex = column.dataIndex,
align = column.align,
title = column.title,
sortEnable = column.sortEnable,
onHeaderCell = column.onHeaderCell;
align = column.align,
title = column.title,
sortEnable = column.sortEnable,
onHeaderCell = column.onHeaderCell;
var rowSpan = column[_types.CS.rowSpan];

@@ -127,52 +97,33 @@ var width = column[_types.CS._width];

if (sortEnable && children.length === 0) {
cellProps.onClick = function() {
return onSort(
column.dataIndex,
order === 'desc' || order === true ? 'asc' : 'desc'
);
cellProps.onClick = function () {
return onSort(column.dataIndex, order === 'desc' || order === true ? 'asc' : 'desc');
};
}
var cell = _react.default.createElement('div', cellProps, text, sorter);
var cell = _react.default.createElement("div", cellProps, text, sorter);
if (children.length > 0) {
return _react.default.createElement(
'div',
{
className: current === 0 ? 'row-group' : '',
key: key,
fixed: fixed
},
cell,
_react.default.createElement(
'div',
{
className: 'col-group'
},
_react.default.createElement(
_Sortable.default,
{
parent: column,
columns: children,
onDrag: onDrag
},
children.map(function(child, i) {
return HeadCell({
key: ''
.concat(key, '-')
.concat(current, '-')
.concat(i),
column: child,
headerRowHeight: headerRowHeight,
current: current + 1,
orders: orders,
prefixCls: prefixCls,
onSort: onSort,
fixed: fixed,
onDrag: onDrag
});
})
)
)
);
return _react.default.createElement("div", {
className: current === 0 ? 'row-group' : '',
key: key,
fixed: fixed
}, cell, _react.default.createElement("div", {
className: "col-group"
}, _react.default.createElement(_Sortable.default, {
parent: column,
columns: children,
onDrag: onDrag
}, children.map(function (child, i) {
return HeadCell({
key: "".concat(key, "-").concat(current, "-").concat(i),
column: child,
headerRowHeight: headerRowHeight,
current: current + 1,
orders: orders,
prefixCls: prefixCls,
onSort: onSort,
fixed: fixed,
onDrag: onDrag
});
}))));
}

@@ -184,2 +135,2 @@

var _default = HeadCell;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,22 +8,20 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _BaseTable = _interopRequireDefault(require('./BaseTable'));
var _BaseTable = _interopRequireDefault(require("./BaseTable"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function HeadTable(props, _ref) {
var manager = _ref.manager,
baseProps = _ref.props;
baseProps = _ref.props;
var fixedHeader = baseProps.fixedHeader,
prefixCls = baseProps.prefixCls,
showHeader = baseProps.showHeader;
prefixCls = baseProps.prefixCls,
showHeader = baseProps.showHeader;
var saveRef = props.saveRef,
fixed = props.fixed;
fixed = props.fixed;
var sizeManager = manager.sizeManager,
columnManager = manager.columnManager;
columnManager = manager.columnManager;
var headStyle = {};

@@ -35,3 +33,3 @@

if (scrollbarWidth > 0 && !fixed) {
headStyle.marginBottom = '-'.concat(scrollbarWidth, 'px');
headStyle.marginBottom = "-".concat(scrollbarWidth, "px");
headStyle.paddingBottom = '0px';

@@ -45,17 +43,13 @@ }

headStyle.overflowY = sizeManager._hasScrollY ? 'scroll' : 'hidden';
return _react.default.createElement(
'div',
{
key: 'headTable',
className: ''.concat(prefixCls, '-header'),
style: headStyle,
ref: fixed ? null : saveRef('headTable')
},
_react.default.createElement(_BaseTable.default, {
hasHead: true,
hasBody: false,
fixed: fixed,
columns: columnManager.headColumns(fixed)
})
);
return _react.default.createElement("div", {
key: "headTable",
className: "".concat(prefixCls, "-header"),
style: headStyle,
ref: fixed ? null : saveRef('headTable')
}, _react.default.createElement(_BaseTable.default, {
hasHead: true,
hasBody: false,
fixed: fixed,
columns: columnManager.headColumns(fixed)
}));
}

@@ -71,2 +65,2 @@

manager: _propTypes.default.object
};
};

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,932 +8,612 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
var _floor = _interopRequireDefault(require('lodash/floor'));
var _floor = _interopRequireDefault(require("lodash/floor"));
var _ceil = _interopRequireDefault(require('lodash/ceil'));
var _ceil = _interopRequireDefault(require("lodash/ceil"));
var _shallowequal = _interopRequireDefault(require('shallowequal'));
var _shallowequal = _interopRequireDefault(require("shallowequal"));
var _componentClasses = _interopRequireDefault(require('component-classes'));
var _componentClasses = _interopRequireDefault(require("component-classes"));
var _HeadTable = _interopRequireDefault(require('./HeadTable'));
var _HeadTable = _interopRequireDefault(require("./HeadTable"));
var _BodyTable = _interopRequireDefault(require('./BodyTable'));
var _BodyTable = _interopRequireDefault(require("./BodyTable"));
var _ColumnManager = _interopRequireDefault(
require('./managers/ColumnManager')
);
var _ColumnManager = _interopRequireDefault(require("./managers/ColumnManager"));
var _DataManager = _interopRequireDefault(require('./managers/DataManager'));
var _DataManager = _interopRequireDefault(require("./managers/DataManager"));
var _SortManager = _interopRequireDefault(require('./managers/SortManager'));
var _SortManager = _interopRequireDefault(require("./managers/SortManager"));
var _SizeManager = _interopRequireDefault(require('./managers/SizeManager'));
var _SizeManager = _interopRequireDefault(require("./managers/SizeManager"));
var _CacheManager = _interopRequireDefault(require('./managers/CacheManager'));
var _CacheManager = _interopRequireDefault(require("./managers/CacheManager"));
var _AutoSizer = _interopRequireDefault(require('./AutoSizer'));
var _AutoSizer = _interopRequireDefault(require("./AutoSizer"));
var _miniStore = require('./mini-store');
var _miniStore = require("./mini-store");
var _types = require('./types');
var _types = require("./types");
var _utils = require('./utils');
var _utils = require("./utils");
require('../theme/table.css');
require("../theme/table.css");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Table =
/*#__PURE__*/
(function(_React$PureComponent) {
_inherits(Table, _React$PureComponent);
/*#__PURE__*/
function (_React$PureComponent) {
_inherits(Table, _React$PureComponent);
function Table(props) {
var _this;
function Table(props) {
var _this;
_classCallCheck(this, Table);
_classCallCheck(this, Table);
_this = _possibleConstructorReturn(
this,
_getPrototypeOf(Table).call(this, props)
);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Table).call(this, props));
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_forceTable',
{}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_forceTable", {});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_renderEnable',
false
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_renderEnable", false);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'state',
{
width: 0,
height: 0
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
width: 0,
height: 0
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'updateAll',
function() {
_this.resetShowData();
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateAll", function () {
_this.resetShowData();
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getShowCount',
function() {
var showHeader = _this.props.showHeader;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getProps", function (prop) {
return _this.props[prop];
});
var dataSource = _this.dataManager.showData();
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getShowCount", function () {
var showHeader = _this.props.showHeader;
var _height = _this._height || 0;
var dataSource = _this.dataManager.showData();
if (showHeader) {
_height -= _this.sizeManager._headerHeight;
_height = Math.max(_height, 0);
}
var _height = _this._height || 0;
_this.showCount = Math.min(
(0, _ceil.default)(_height / _this.props.rowHeight),
dataSource.length
);
}
);
if (showHeader) {
_height -= _this.sizeManager._headerHeight;
_height = Math.max(_height, 0);
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'onResize',
function(_ref) {
var width = _ref.width,
height = _ref.height;
_this._renderEnable = true;
_this._width = width;
_this._height = height;
_this.showCount = Math.min((0, _ceil.default)(_height / _this.props.rowHeight), dataSource.length);
});
_this.cacheManager.reset();
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onResize", function (_ref) {
var width = _ref.width,
height = _ref.height;
_this.sizeManager.update({
_wrapperWidth: width,
_wrapperHeight: height,
_scrollSizeX: (0, _utils.measureScrollbar)('horizontal'),
_scrollSizeY: (0, _utils.measureScrollbar)()
});
if (_this._width !== width || _this._height !== height) {
_this._renderEnable = true;
_this._width = width;
_this._height = height;
_this.getShowCount();
_this.cacheManager.reset();
_this.updateColumn();
_this.sizeManager.update({
_wrapperWidth: width,
_wrapperHeight: height,
_scrollSizeX: (0, _utils.measureScrollbar)('horizontal'),
_scrollSizeY: (0, _utils.measureScrollbar)()
});
_this.resetShowData(); // this.setState({width, height});
}
);
_this.getShowCount();
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'updateColumn',
function() {
if (_this.sizeManager._wrapperWidth > 0) {
var cWidth =
_this.sizeManager._wrapperWidth - _this.sizeManager.scrollSizeY();
_this.updateColumn();
_this.sizeManager.update(_this.columnManager.updateWidth(cWidth));
}
}
);
_this.resetShowData();
}
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleBodyScroll',
function(e) {
var onScroll = _this.props.onScroll;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateColumn", function () {
if (_this.sizeManager._wrapperWidth > 0) {
var cWidth = _this.sizeManager._wrapperWidth - _this.sizeManager.scrollSizeY();
_this.handleBodyScrollLeft(e);
_this.sizeManager.update(_this.columnManager.updateWidth(cWidth));
}
});
_this.handleBodyScrollTop(e);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleBodyScroll", function (e) {
var onScroll = _this.props.onScroll;
if (typeof onScroll === 'function') {
onScroll(e);
}
}
);
_this.handleBodyScrollLeft(e);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleBodyScrollLeft',
function(e) {
if (e.currentTarget !== e.target) {
return;
}
_this.handleBodyScrollTop(e);
var target = e.target;
if (typeof onScroll === 'function') {
onScroll(e);
}
});
var _assertThisInitialize = _assertThisInitialized(
_assertThisInitialized(_this)
),
headTable = _assertThisInitialize.headTable,
bodyTable = _assertThisInitialize.bodyTable;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleBodyScrollLeft", function (e) {
if (e.currentTarget !== e.target) {
return;
}
if (target.scrollLeft !== _this.lastScrollLeft) {
if (target === bodyTable && headTable) {
headTable.scrollLeft = target.scrollLeft;
}
var target = e.target;
_this.setScrollPositionClassName();
}
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
headTable = _assertThisInitialize.headTable,
bodyTable = _assertThisInitialize.bodyTable;
_this.lastScrollLeft = target.scrollLeft;
_this.sizeManager.update({
_scrollLeft: _this.lastScrollLeft
});
if (target.scrollLeft !== _this.lastScrollLeft) {
if (target === bodyTable && headTable) {
headTable.scrollLeft = target.scrollLeft;
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'updateScrollLeft',
function(scrollLeft) {
var _assertThisInitialize2 = _assertThisInitialized(
_assertThisInitialized(_this)
),
headTable = _assertThisInitialize2.headTable,
bodyTable = _assertThisInitialize2.bodyTable;
_this.setScrollPositionClassName();
}
if (!bodyTable || bodyTable.scrollHeight === 0) {
return;
}
_this.lastScrollLeft = target.scrollLeft;
if (_this.lastScrollLeft !== scrollLeft) {
if (headTable) {
headTable.scrollLeft = scrollLeft;
}
_this.sizeManager.update({
_scrollLeft: _this.lastScrollLeft
});
});
if (bodyTable) {
bodyTable.scrollLeft = scrollLeft;
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateScrollLeft", function (scrollLeft) {
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
headTable = _assertThisInitialize2.headTable,
bodyTable = _assertThisInitialize2.bodyTable;
_this.setScrollPositionClassName();
}
if (!bodyTable || bodyTable.scrollHeight === 0) {
return;
}
_this.lastScrollLeft = scrollLeft;
_this.sizeManager.update({
_scrollLeft: _this.lastScrollLeft
});
if (_this.lastScrollLeft !== scrollLeft) {
if (headTable) {
headTable.scrollLeft = scrollLeft;
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'updateScrollTop',
function(target) {
[
'bodyTable',
'fixedColumnsBodyLeft',
'fixedColumnsBodyRight'
].forEach(function(node) {
if (_this[node] && target !== _this[node]) {
_this[node].scrollTop = target.scrollTop;
}
});
if (bodyTable) {
bodyTable.scrollLeft = scrollLeft;
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleBodyScrollTop',
function(e) {
var target = e.target;
_this.setScrollPositionClassName();
}
if (target !== e.currentTarget) {
return;
}
_this.lastScrollLeft = scrollLeft;
var _assertThisInitialize3 = _assertThisInitialized(
_assertThisInitialized(_this)
),
headTable = _assertThisInitialize3.headTable;
_this.sizeManager.update({
_scrollLeft: _this.lastScrollLeft
});
});
if (
_this.lastScrollTop !== target.scrollTop &&
target !== headTable
) {
_this.updateScrollTop(target);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateScrollTop", function (target) {
['bodyTable', 'fixedColumnsBodyLeft', 'fixedColumnsBodyRight'].forEach(function (node) {
if (_this[node] && target !== _this[node]) {
_this[node].scrollTop = target.scrollTop;
}
});
});
_this.sizeManager.update({
_scrollTop: target.scrollTop
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleBodyScrollTop", function (e) {
var target = e.target;
_this.resetShowData(target);
if (target !== e.currentTarget) {
return;
}
if (_this.props.refreshEnable) {
_this.scrollRefresh(target);
}
}
var _assertThisInitialize3 = _assertThisInitialized(_assertThisInitialized(_this)),
headTable = _assertThisInitialize3.headTable;
_this.lastScrollTop = target.scrollTop;
}
);
if (_this.lastScrollTop !== target.scrollTop && target !== headTable) {
_this.updateScrollTop(target);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'scrollRefresh',
function(target) {
var _this$props = _this.props,
scrollEndPosition = _this$props.scrollEndPosition,
onScrollEnd = _this$props.onScrollEnd;
_this.sizeManager.update({
_scrollTop: target.scrollTop
});
if (
target.scrollTop + target.clientHeight + scrollEndPosition >
target.scrollHeight &&
_this.refreshAble
) {
if (typeof onScrollEnd === 'function') {
onScrollEnd();
_this.refreshAble = false;
}
} else {
_this.refreshAble = true;
}
_this.resetShowData(target);
if (_this.props.refreshEnable) {
_this.scrollRefresh(target);
}
);
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'resetShowData',
function() {
var scrollTop = _this.sizeManager._scrollTop;
var rowHeight = _this.props.rowHeight;
var dataSource = _this.dataManager.showData() || [];
var state = {};
_this.lastScrollTop = target.scrollTop;
});
if (!_this.sizeManager._hasScrollY) {
state.startIndex = 0;
state.stopIndex = dataSource.length - 1;
} else {
var startIndex = (0, _floor.default)(scrollTop / rowHeight) - 1;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "scrollRefresh", function (target) {
var _this$props = _this.props,
scrollEndPosition = _this$props.scrollEndPosition,
onScrollEnd = _this$props.onScrollEnd;
for (var i = 0; i < dataSource.length; i++) {
if (scrollTop < dataSource[i][_types.DS._top]) {
startIndex = i - 1;
break;
}
}
if (target.scrollTop + target.clientHeight + scrollEndPosition > target.scrollHeight && _this.refreshAble) {
if (typeof onScrollEnd === 'function') {
onScrollEnd();
_this.refreshAble = false;
}
} else {
_this.refreshAble = true;
}
});
state.startIndex = Math.max(0, startIndex - 2);
state.stopIndex = Math.min(
startIndex + _this.showCount + 2,
dataSource.length - 1
);
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "resetShowData", function () {
var scrollTop = _this.sizeManager._scrollTop;
var rowHeight = _this.props.rowHeight;
var dataSource = _this.dataManager.showData() || [];
var state = {};
_this.sizeManager.update({
_startIndex: state.startIndex,
_stopIndex: state.stopIndex
});
if (!_this.sizeManager._hasScrollY) {
state.startIndex = 0;
state.stopIndex = dataSource.length - 1;
} else {
var startIndex = (0, _floor.default)(scrollTop / rowHeight) - 1;
for (var key in _this._forceTable) {
if (
_this._forceTable.hasOwnProperty(key) &&
_this._forceTable[key]
) {
_this._forceTable[key](state);
}
for (var i = 0; i < dataSource.length; i++) {
if (scrollTop < dataSource[i][_types.DS._top]) {
startIndex = i - 1;
break;
}
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleExpandChange',
function(key) {
var onExpandedRowsChange = _this.props.onExpandedRowsChange;
var dataManager = _this.dataManager;
state.startIndex = Math.max(0, startIndex - 2);
state.stopIndex = Math.min(startIndex + _this.showCount + 2, dataSource.length - 1);
}
_this.cacheManager.reset();
_this.sizeManager.update({
_startIndex: state.startIndex,
_stopIndex: state.stopIndex
});
var result = dataManager.expanded(key);
for (var key in _this._forceTable) {
if (_this._forceTable.hasOwnProperty(key) && _this._forceTable[key]) {
_this._forceTable[key](state);
}
}
});
if (typeof onExpandedRowsChange === 'function') {
onExpandedRowsChange(result);
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleExpandChange", function (key) {
var onExpandedRowsChange = _this.props.onExpandedRowsChange;
var dataManager = _this.dataManager;
_this.getShowCount();
_this.cacheManager.reset();
_this.sizeManager.update({
_dataHeight: _this.dataManager._bodyHeight
});
var result = dataManager.expanded(key);
_this.resetShowData();
if (typeof onExpandedRowsChange === 'function') {
onExpandedRowsChange(result);
}
_this.forceUpdate();
}
);
_this.getShowCount();
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'saveRef',
function(name) {
return function(node) {
_this[name] = node;
};
}
);
_this.sizeManager.update({
_dataHeight: _this.dataManager._bodyHeight
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'registerForce',
function(name, fn) {
_this._forceTable[name || 'body'] = fn;
}
);
_this.resetShowData();
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'getClassName',
function() {
var _classNames;
_this.forceUpdate();
});
var _this$props2 = _this.props,
prefixCls = _this$props2.prefixCls,
className = _this$props2.className,
fixedHeader = _this$props2.fixedHeader,
bordered = _this$props2.bordered;
return (0, _classnames.default)(
prefixCls,
className,
((_classNames = {}),
_defineProperty(
_classNames,
''.concat(prefixCls, '-fixed-header'),
fixedHeader
),
_defineProperty(_classNames, 'bordered', bordered),
_defineProperty(
_classNames,
''.concat(prefixCls, '-expanded'),
_this.dataManager.isExpanded()
),
_classNames)
);
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveRef", function (name) {
return function (node) {
_this[name] = node;
};
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderTable',
function(options) {
var fixed = options.fixed;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "registerForce", function (name, fn) {
_this._forceTable[name || 'body'] = fn;
});
var headTable = _react.default.createElement(_HeadTable.default, {
key: 'head',
fixed: fixed,
saveRef: _this.saveRef
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getClassName", function () {
var _classNames;
var bodyTable = _react.default.createElement(_BodyTable.default, {
key: 'body',
fixed: fixed,
saveRef: _this.saveRef,
handleBodyScroll: _this.handleBodyScroll,
registerForce: _this.registerForce
});
var _this$props2 = _this.props,
prefixCls = _this$props2.prefixCls,
className = _this$props2.className,
fixedHeader = _this$props2.fixedHeader,
bordered = _this$props2.bordered;
return (0, _classnames.default)(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-fixed-header"), fixedHeader), _defineProperty(_classNames, "bordered", bordered), _defineProperty(_classNames, "".concat(prefixCls, "-expanded"), _this.dataManager.isExpanded()), _classNames));
});
return [headTable, bodyTable];
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderTable", function (options) {
var fixed = options.fixed;
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'fixedClassName',
function(fixed) {
return ''.concat(_this.props.prefixCls, '-fixed-').concat(fixed);
}
);
var headTable = _react.default.createElement(_HeadTable.default, {
key: "head",
fixed: fixed,
saveRef: _this.saveRef
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderMainTable',
function() {
var table = _this.renderTable({});
var bodyTable = _react.default.createElement(_BodyTable.default, {
key: "body",
fixed: fixed,
saveRef: _this.saveRef,
handleBodyScroll: _this.handleBodyScroll,
registerForce: _this.registerForce
});
return [table, _this.renderEmptyText()];
}
);
return [headTable, bodyTable];
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderLeftFixedTable',
function() {
var table = _this.renderTable({
fixed: 'left'
});
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "fixedClassName", function (fixed) {
return "".concat(_this.props.prefixCls, "-fixed-").concat(fixed);
});
return _react.default.createElement(
'div',
{
className: _this.fixedClassName('left')
},
table
);
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderMainTable", function () {
var table = _this.renderTable({});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderRightFixedTable',
function() {
var table = _this.renderTable({
fixed: 'right'
});
return [table, _this.renderEmptyText()];
});
return _react.default.createElement(
'div',
{
className: _this.fixedClassName('right')
},
table
);
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderLeftFixedTable", function () {
var table = _this.renderTable({
fixed: 'left'
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderFooter',
function() {
var _this$props3 = _this.props,
footer = _this$props3.footer,
footerHeight = _this$props3.footerHeight,
prefixCls = _this$props3.prefixCls;
return footer
? _react.default.createElement(
'div',
{
key: 'table-footer',
className: ''.concat(prefixCls, '-footer'),
style: {
flex: '0 1 '.concat(footerHeight, 'px'),
height: footerHeight,
color: 'inherit'
}
},
footer(_this.props.dataSource)
)
: null;
}
);
return _react.default.createElement("div", {
className: _this.fixedClassName('left')
}, table);
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderEmptyText',
function() {
var _this$props4 = _this.props,
emptyText = _this$props4.emptyText,
dataSource = _this$props4.dataSource,
rowHeight = _this$props4.rowHeight,
prefixCls = _this$props4.prefixCls,
fixedHeader = _this$props4.fixedHeader,
showHeader = _this$props4.showHeader;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderRightFixedTable", function () {
var table = _this.renderTable({
fixed: 'right'
});
if (dataSource && dataSource.length > 0) {
return null;
}
return _react.default.createElement("div", {
className: _this.fixedClassName('right')
}, table);
});
var style = {
height: rowHeight,
lineHeight: rowHeight + 'px',
flex: '0 1 '.concat(rowHeight, 'px'),
textAlign: 'center'
};
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderFooter", function () {
var _this$props3 = _this.props,
footer = _this$props3.footer,
footerHeight = _this$props3.footerHeight,
prefixCls = _this$props3.prefixCls;
return footer ? _react.default.createElement("div", {
key: "table-footer",
className: "".concat(prefixCls, "-footer"),
style: {
flex: "0 1 ".concat(footerHeight, "px"),
height: footerHeight,
color: 'inherit'
}
}, footer(_this.props.dataSource)) : null;
});
var scrollSizeX = _this.sizeManager.scrollSizeX();
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderEmptyText", function () {
var _this$props4 = _this.props,
emptyText = _this$props4.emptyText,
dataSource = _this$props4.dataSource,
rowHeight = _this$props4.rowHeight,
prefixCls = _this$props4.prefixCls,
fixedHeader = _this$props4.fixedHeader,
showHeader = _this$props4.showHeader;
if (scrollSizeX > 0 && fixedHeader && showHeader) {
style.marginTop = ''.concat(scrollSizeX, 'px');
}
if (dataSource && dataSource.length > 0) {
return null;
}
return typeof emptyText === 'function'
? _react.default.createElement(
'div',
{
key: 'table-empty-text',
className: ''.concat(prefixCls, '-empty-text'),
style: style
},
emptyText()
)
: emptyText;
}
);
var style = {
height: rowHeight,
lineHeight: rowHeight + 'px',
flex: "0 1 ".concat(rowHeight, "px"),
textAlign: 'center'
};
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'renderChild',
function(params) {
if (!_this._renderEnable) {
return null;
}
var scrollSizeX = _this.sizeManager.scrollSizeX();
_this.onResize(params);
if (scrollSizeX > 0 && fixedHeader && showHeader) {
style.marginTop = "".concat(scrollSizeX, "px");
}
var _this$props5 = _this.props,
style = _this$props5.style,
prefixCls = _this$props5.prefixCls;
return typeof emptyText === 'function' ? _react.default.createElement("div", {
key: "table-empty-text",
className: "".concat(prefixCls, "-empty-text"),
style: style
}, emptyText()) : emptyText;
});
var hasLeftFixed = _this.columnManager.isAnyColumnsLeftFixed();
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderChild", function (params) {
if (!_this._renderEnable) {
return null;
}
var hasRightFixed = _this.columnManager.isAnyColumnsRightFixed();
_this.onResize(params);
return _react.default.createElement(
'div',
{
className: _this.getClassName(),
ref: _this.saveRef('tableNode'),
style: _objectSpread({}, style, {
width: _this.sizeManager._wrapperWidth,
height: _this.sizeManager._wrapperHeight
})
},
_react.default.createElement(
'div',
{
className: ''.concat(prefixCls, '-content')
},
_this.renderMainTable(),
hasLeftFixed && _this.renderLeftFixedTable(),
hasRightFixed && _this.renderRightFixedTable()
),
_this.renderFooter()
);
}
);
var _this$props5 = _this.props,
style = _this$props5.style,
prefixCls = _this$props5.prefixCls;
_this.lastScrollTop = 0;
_this.lastScrollLeft = 0;
_this.refreshAble = true;
_this.showCount = props.defaultShowCount || 20;
_this.columnManager = new _ColumnManager.default(props);
_this.dataManager = new _DataManager.default(props);
_this.sortManager = new _SortManager.default({
columns: _this.columnManager.groupedColumns(),
sortMulti: props.sortMulti
});
_this.sizeManager = new _SizeManager.default(props);
_this.cacheManager = new _CacheManager.default();
var hasLeftFixed = _this.columnManager.isAnyColumnsLeftFixed();
_this.sizeManager.update(
_objectSpread(
{
_dataHeight: _this.dataManager._bodyHeight,
_dataEmpty: _this.dataManager.isEmpty(),
_scrollSizeX: props.scrollSize.x,
_scrollSizeY: props.scrollSize.y
},
_this.columnManager.headerSize()
)
);
var hasRightFixed = _this.columnManager.isAnyColumnsRightFixed();
_this.store = (0, _miniStore.create)({
currentHoverKey: null,
orders: _this.sortManager.enabled()
});
return _this;
}
return _react.default.createElement("div", {
className: _this.getClassName(),
ref: _this.saveRef('tableNode'),
style: _objectSpread({}, style, {
width: _this.sizeManager._wrapperWidth,
height: _this.sizeManager._wrapperHeight
})
}, _react.default.createElement("div", {
className: "".concat(prefixCls, "-content")
}, _this.renderMainTable(), hasLeftFixed && _this.renderLeftFixedTable(), hasRightFixed && _this.renderRightFixedTable()), _this.renderFooter());
});
_createClass(Table, [
{
key: 'getChildContext',
value: function getChildContext() {
return {
props: this.props,
manager: {
columnManager: this.columnManager,
dataManager: this.dataManager,
sortManager: this.sortManager,
sizeManager: this.sizeManager,
cacheManager: this.cacheManager
},
expandChange: this.handleExpandChange,
updateScrollLeft: this.updateScrollLeft,
update: this.updateAll
};
}
},
{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (
!(0, _shallowequal.default)(
nextProps.dataSource,
this.props.dataSource
)
) {
this.dataManager.reset(nextProps.dataSource);
this.sizeManager.update({
_dataHeight: this.dataManager._bodyHeight,
_dataEmpty: this.dataManager.isEmpty()
});
this.cacheManager.reset();
this.getShowCount();
this.resetShowData();
}
_this.lastScrollTop = 0;
_this.lastScrollLeft = 0;
_this.refreshAble = true;
_this.showCount = props.defaultShowCount || 20;
_this.columnManager = new _ColumnManager.default(props);
_this.dataManager = new _DataManager.default(props);
_this.sortManager = new _SortManager.default({
columns: _this.columnManager.groupedColumns(),
sortMulti: props.sortMulti
});
_this.sizeManager = new _SizeManager.default(props);
_this.cacheManager = new _CacheManager.default();
if (
!(0, _shallowequal.default)(nextProps.columns, this.props.columns)
) {
this.sizeManager.update(this.columnManager.reset(nextProps));
this.sortManager.update({
columns: this.columnManager.groupedColumns(),
sortMulti: nextProps.sortMulti
});
this.store.setState({
orders: this.sortManager.enable
});
this.cacheManager.reset();
this.updateColumn();
}
_this.sizeManager.update(_objectSpread({
_dataHeight: _this.dataManager._bodyHeight,
_dataEmpty: _this.dataManager.isEmpty(),
_scrollSizeX: props.scrollSize.x,
_scrollSizeY: props.scrollSize.y
}, _this.columnManager.headerSize()));
if (
!(0, _shallowequal.default)(
nextProps.expandedRowKeys,
this.props.expandedRowKeys
)
) {
this.dataManager.resetExpandedRowKeys(nextProps.expandedRowKeys);
this.sizeManager.update({
_dataHeight: this.dataManager._bodyHeight,
_dataEmpty: this.dataManager.isEmpty()
});
this.cacheManager.reset();
this.getShowCount();
this.resetShowData();
}
}
},
{
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this.setScrollPositionClassName();
}
},
{
key: 'setScrollPosition',
value: function setScrollPosition(position) {
this.scrollPosition = position;
var tableNode = this.tableNode;
_this.store = (0, _miniStore.create)({
currentHoverKey: null,
orders: _this.sortManager.enabled()
});
return _this;
}
if (tableNode) {
var prefixCls = this.props.prefixCls;
_createClass(Table, [{
key: "getChildContext",
value: function getChildContext() {
return {
props: this.props,
manager: {
columnManager: this.columnManager,
dataManager: this.dataManager,
sortManager: this.sortManager,
sizeManager: this.sizeManager,
cacheManager: this.cacheManager
},
expandChange: this.handleExpandChange,
updateScrollLeft: this.updateScrollLeft,
update: this.updateAll,
getProps: this.getProps
};
}
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
if (!(0, _shallowequal.default)(nextProps.dataSource, this.props.dataSource)) {
this.dataManager.reset(nextProps.dataSource);
this.sizeManager.update({
_dataHeight: this.dataManager._bodyHeight,
_dataEmpty: this.dataManager.isEmpty()
});
this.cacheManager.reset();
this.getShowCount();
this.resetShowData();
}
if (position === 'clear') {
(0, _componentClasses.default)(tableNode).remove(
new RegExp('^'.concat(prefixCls, '-scroll-position-.+$'))
);
} else if (position === 'both') {
(0, _componentClasses.default)(tableNode)
.remove(
new RegExp('^'.concat(prefixCls, '-scroll-position-.+$'))
)
.add(''.concat(prefixCls, '-scroll-position-left'))
.add(''.concat(prefixCls, '-scroll-position-right'));
} else {
(0, _componentClasses.default)(tableNode)
.remove(
new RegExp('^'.concat(prefixCls, '-scroll-position-.+$'))
)
.add(
''.concat(prefixCls, '-scroll-position-').concat(position)
);
}
}
}
},
{
key: 'setScrollPositionClassName',
value: function setScrollPositionClassName() {
var node = this['bodyTable'];
var scrollToLeft = node.scrollLeft === 0;
var scrollToRight =
node.scrollLeft + 1 >=
node.children[0].getBoundingClientRect().width -
node.getBoundingClientRect().width;
if (!(0, _shallowequal.default)(nextProps.columns, this.props.columns)) {
this.sizeManager.update(this.columnManager.reset(nextProps));
this.sortManager.update({
columns: this.columnManager.groupedColumns(),
sortMulti: nextProps.sortMulti
});
this.store.setState({
orders: this.sortManager.enable
});
this.cacheManager.reset();
this.updateColumn();
}
if (!this.sizeManager._hasScrollX) {
this.setScrollPosition('clear');
} else if (scrollToLeft && scrollToRight) {
this.setScrollPosition('both');
} else if (scrollToLeft) {
this.setScrollPosition('left');
} else if (scrollToRight) {
this.setScrollPosition('right');
} else if (this.scrollPosition !== 'middle') {
this.setScrollPosition('middle');
}
}
},
{
key: 'render',
value: function render() {
var prefixCls = this.props.prefixCls;
if (!(0, _shallowequal.default)(nextProps.expandedRowKeys, this.props.expandedRowKeys)) {
this.dataManager.resetExpandedRowKeys(nextProps.expandedRowKeys);
this.sizeManager.update({
_dataHeight: this.dataManager._bodyHeight,
_dataEmpty: this.dataManager.isEmpty()
});
this.cacheManager.reset();
this.getShowCount();
this.resetShowData();
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.setScrollPositionClassName();
}
}, {
key: "setScrollPosition",
value: function setScrollPosition(position) {
this.scrollPosition = position;
var tableNode = this.tableNode;
var autoSizeProps = _objectSpread({}, this.props, {
onResize: this.onResize,
className: ''.concat(prefixCls, '-auto-size')
});
if (tableNode) {
var prefixCls = this.props.prefixCls;
return _react.default.createElement(
_miniStore.Provider,
{
store: this.store
},
_react.default.createElement(
_AutoSizer.default,
autoSizeProps,
this.renderChild
)
);
if (position === 'clear') {
(0, _componentClasses.default)(tableNode).remove(new RegExp("^".concat(prefixCls, "-scroll-position-.+$")));
} else if (position === 'both') {
(0, _componentClasses.default)(tableNode).remove(new RegExp("^".concat(prefixCls, "-scroll-position-.+$"))).add("".concat(prefixCls, "-scroll-position-left")).add("".concat(prefixCls, "-scroll-position-right"));
} else {
(0, _componentClasses.default)(tableNode).remove(new RegExp("^".concat(prefixCls, "-scroll-position-.+$"))).add("".concat(prefixCls, "-scroll-position-").concat(position));
}
}
]);
}
}, {
key: "setScrollPositionClassName",
value: function setScrollPositionClassName() {
var node = this['bodyTable'];
var scrollToLeft = node.scrollLeft === 0;
var scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
return Table;
})(_react.default.PureComponent);
if (!this.sizeManager._hasScrollX) {
this.setScrollPosition('clear');
} else if (scrollToLeft && scrollToRight) {
this.setScrollPosition('both');
} else if (scrollToLeft) {
this.setScrollPosition('left');
} else if (scrollToRight) {
this.setScrollPosition('right');
} else if (this.scrollPosition !== 'middle') {
this.setScrollPosition('middle');
}
}
}, {
key: "render",
value: function render() {
var prefixCls = this.props.prefixCls;
var autoSizeProps = _objectSpread({}, this.props, {
onResize: this.onResize,
className: "".concat(prefixCls, "-auto-size")
});
return _react.default.createElement(_miniStore.Provider, {
store: this.store
}, _react.default.createElement(_AutoSizer.default, autoSizeProps, this.renderChild));
}
}]);
return Table;
}(_react.default.PureComponent);
exports.default = Table;
_defineProperty(Table, 'defaultProps', _types.TableDefaultParams);
_defineProperty(Table, "defaultProps", _types.TableDefaultParams);
_defineProperty(Table, 'childContextTypes', {
_defineProperty(Table, "childContextTypes", {
props: _propTypes.default.object,

@@ -943,3 +623,4 @@ manager: _propTypes.default.object,

updateScrollLeft: _propTypes.default.func,
update: _propTypes.default.func
});
update: _propTypes.default.func,
getProps: _propTypes.default.func
});

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,27 +8,9 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -40,27 +22,27 @@ var CacheManager = function CacheManager() {

_defineProperty(this, '_rowCache', {});
_defineProperty(this, "_rowCache", {});
_defineProperty(this, '_cellCache', {});
_defineProperty(this, "_cellCache", {});
_defineProperty(this, '_styleCache', {});
_defineProperty(this, "_styleCache", {});
_defineProperty(this, '_rowStyleCache', {});
_defineProperty(this, "_rowStyleCache", {});
_defineProperty(this, 'setRow', function(key, element) {
_defineProperty(this, "setRow", function (key, element) {
_this._rowCache[key] = element;
});
_defineProperty(this, 'getRow', function(key) {
_defineProperty(this, "getRow", function (key) {
return _this._rowCache[key];
});
_defineProperty(this, 'setCell', function(key, element) {
_defineProperty(this, "setCell", function (key, element) {
_this._cellCache[key] = element;
});
_defineProperty(this, 'getCell', function(key) {
_defineProperty(this, "getCell", function (key) {
return _this._cellCache[key];
});
_defineProperty(this, 'reset', function() {
_defineProperty(this, "reset", function () {
_this._cellCache = {};

@@ -70,15 +52,15 @@ _this._rowStyleCache = {};

_defineProperty(this, 'setStyle', function(key, style) {
_defineProperty(this, "setStyle", function (key, style) {
_this._styleCache[key] = style;
});
_defineProperty(this, 'getStyle', function(key) {
_defineProperty(this, "getStyle", function (key) {
return _this._styleCache[key];
});
_defineProperty(this, 'getRowStyle', function(key) {
_defineProperty(this, "getRowStyle", function (key) {
return _this._rowStyleCache[key];
});
_defineProperty(this, 'setRowStyle', function(key, style) {
_defineProperty(this, "setRowStyle", function (key, style) {
_this._rowStyleCache[key] = style;

@@ -89,2 +71,2 @@ });

var _default = CacheManager;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,119 +8,50 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _max = _interopRequireDefault(require('lodash/max'));
var _max = _interopRequireDefault(require("lodash/max"));
var _multiply = _interopRequireDefault(require('lodash/multiply'));
var _multiply = _interopRequireDefault(require("lodash/multiply"));
var _isNumber = _interopRequireDefault(require('lodash/isNumber'));
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
var _toNumber = _interopRequireDefault(require('lodash/toNumber'));
var _toNumber = _interopRequireDefault(require("lodash/toNumber"));
var _divide = _interopRequireDefault(require('lodash/divide'));
var _divide = _interopRequireDefault(require("lodash/divide"));
var _floor = _interopRequireDefault(require('lodash/floor'));
var _floor = _interopRequireDefault(require("lodash/floor"));
var _sumBy = _interopRequireDefault(require('lodash/sumBy'));
var _sumBy = _interopRequireDefault(require("lodash/sumBy"));
var _isNaN = _interopRequireDefault(require('lodash/isNaN'));
var _isNaN = _interopRequireDefault(require("lodash/isNaN"));
var _min = _interopRequireDefault(require('lodash/min'));
var _min = _interopRequireDefault(require("lodash/min"));
var _types = require('../types');
var _types = require("../types");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _toConsumableArray(arr) {
return (
_arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread()
);
}
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() {
throw new TypeError('Invalid attempt to spread non-iterable instance');
}
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) {
if (
Symbol.iterator in Object(iter) ||
Object.prototype.toString.call(iter) === '[object Arguments]'
)
return Array.from(iter);
}
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _path = _types.CS._path,
_pathKey = _types.CS._pathKey,
_currentRow = _types.CS._currentRow,
_width = _types.CS._width,
_minWidth = _types.CS._minWidth,
path = _types.CS.path,
rowSpan = _types.CS.rowSpan,
colSpan = _types.CS.colSpan;
_pathKey = _types.CS._pathKey,
_currentRow = _types.CS._currentRow,
_width = _types.CS._width,
_minWidth = _types.CS._minWidth,
path = _types.CS.path,
rowSpan = _types.CS.rowSpan,
colSpan = _types.CS.colSpan;
var percentReg = /^\d+\.?\d{0,2}%$/;

@@ -132,12 +63,12 @@

var _columns = _ref.columns,
_minWidth2 = _ref.minWidth,
_headerRowHeight = _ref.headerRowHeight;
_minWidth2 = _ref.minWidth,
_headerRowHeight = _ref.headerRowHeight;
_classCallCheck(this, ColumnManager);
_defineProperty(this, '_cached', {});
_defineProperty(this, "_cached", {});
_defineProperty(this, '_maxRowSpan', 1);
_defineProperty(this, "_maxRowSpan", 1);
_defineProperty(this, 'init', function() {
_defineProperty(this, "init", function () {
_this.width = 0;

@@ -149,5 +80,5 @@ _this.leftWidth = 0;

_defineProperty(this, 'isAnyColumnsLeftFixed', function() {
return _this._cache('isAnyColumnsLeftFixed', function() {
return _this.groupedColumns().some(function(column) {
_defineProperty(this, "isAnyColumnsLeftFixed", function () {
return _this._cache('isAnyColumnsLeftFixed', function () {
return _this.groupedColumns().some(function (column) {
return column.fixed === 'left' || column.fixed === true;

@@ -158,5 +89,5 @@ });

_defineProperty(this, 'isAnyColumnsRightFixed', function() {
return _this._cache('isAnyColumnsRightFixed', function() {
return _this.groupedColumns().some(function(column) {
_defineProperty(this, "isAnyColumnsRightFixed", function () {
return _this._cache('isAnyColumnsRightFixed', function () {
return _this.groupedColumns().some(function (column) {
return column.fixed === 'right';

@@ -167,3 +98,3 @@ });

_defineProperty(this, 'headColumns', function(fixed) {
_defineProperty(this, "headColumns", function (fixed) {
if (fixed === 'left') {

@@ -178,3 +109,3 @@ return _this.leftColumns();

_defineProperty(this, 'bodyColumns', function(fixed) {
_defineProperty(this, "bodyColumns", function (fixed) {
if (fixed === 'left') {

@@ -189,5 +120,5 @@ return _this.leftLeafColumns();

_defineProperty(this, 'leftColumns', function() {
return _this._cache('leftColumns', function() {
return _this.groupedColumns().filter(function(column) {
_defineProperty(this, "leftColumns", function () {
return _this._cache('leftColumns', function () {
return _this.groupedColumns().filter(function (column) {
return column.fixed === 'left' || column.fixed === true;

@@ -198,5 +129,5 @@ });

_defineProperty(this, 'rightColumns', function() {
return _this._cache('rightColumns', function() {
return _this.groupedColumns().filter(function(column) {
_defineProperty(this, "rightColumns", function () {
return _this._cache('rightColumns', function () {
return _this.groupedColumns().filter(function (column) {
return column.fixed === 'right';

@@ -207,4 +138,4 @@ });

_defineProperty(this, 'leafColumns', function() {
return _this._cache('leafColumns', function() {
_defineProperty(this, "leafColumns", function () {
return _this._cache('leafColumns', function () {
return _this._leafColumns(_this.groupedColumns());

@@ -214,4 +145,4 @@ });

_defineProperty(this, 'leftLeafColumns', function() {
return _this._cache('leftLeafColumns', function() {
_defineProperty(this, "leftLeafColumns", function () {
return _this._cache('leftLeafColumns', function () {
return _this._leafColumns(_this.leftColumns());

@@ -221,4 +152,4 @@ });

_defineProperty(this, 'rightLeafColumns', function() {
return _this._cache('rightLeafColumns', function() {
_defineProperty(this, "rightLeafColumns", function () {
return _this._cache('rightLeafColumns', function () {
return _this._leafColumns(_this.rightColumns());

@@ -228,4 +159,4 @@ });

_defineProperty(this, 'groupedColumns', function() {
return _this._cache('groupedColumns', function() {
_defineProperty(this, "groupedColumns", function () {
return _this._cache('groupedColumns', function () {
return _this._updateWidth(_this._groupColumns(_this.columns));

@@ -235,3 +166,3 @@ });

_defineProperty(this, 'headerSize', function() {
_defineProperty(this, "headerSize", function () {
return {

@@ -246,3 +177,3 @@ _leftWidth: _this.leftWidth,

_defineProperty(this, 'updateWidth', function(wrapperWidth) {
_defineProperty(this, "updateWidth", function (wrapperWidth) {
if (_this.wrapperWidth !== wrapperWidth) {

@@ -260,3 +191,3 @@ _this.wrapperWidth = wrapperWidth;

_defineProperty(this, 'getWidth', function(fixed) {
_defineProperty(this, "getWidth", function (fixed) {
if (fixed === 'left' || fixed === true) {

@@ -271,6 +202,6 @@ return _this.leftWidth;

_defineProperty(this, 'reset', function(_ref2) {
_defineProperty(this, "reset", function (_ref2) {
var columns = _ref2.columns,
minWidth = _ref2.minWidth,
headerRowHeight = _ref2.headerRowHeight;
minWidth = _ref2.minWidth,
headerRowHeight = _ref2.headerRowHeight;
_this.columns = columns;

@@ -288,3 +219,3 @@ _this.minWidth = minWidth;

_defineProperty(this, 'updateGroupedColumns', function(columns) {
_defineProperty(this, "updateGroupedColumns", function (columns) {
_this._cached = {};

@@ -295,11 +226,8 @@ _this.columns = _this._uColumns(columns);

_defineProperty(this, '_uColumns', function(columns) {
return columns.map(function(c) {
_defineProperty(this, "_uColumns", function (columns) {
return columns.map(function (c) {
var column = {};
for (var key in c) {
if (
_typeof(key) !== 'symbol' &&
Object.prototype.hasOwnProperty.call(c, key)
) {
if (_typeof(key) !== 'symbol' && Object.prototype.hasOwnProperty.call(c, key)) {
column[key] = c[key];

@@ -319,10 +247,6 @@ }

_defineProperty(this, '_calcWidth', function(width, wrapperWidth) {
_defineProperty(this, "_calcWidth", function (width, wrapperWidth) {
if (typeof width === 'string' && percentReg.test(width)) {
var i = width.replace('%', '');
return (0, _floor.default)(
_this._minWidth(
(0, _multiply.default)(wrapperWidth, (0, _divide.default)(i, 100))
)
);
return (0, _floor.default)(_this._minWidth((0, _multiply.default)(wrapperWidth, (0, _divide.default)(i, 100))));
}

@@ -343,7 +267,7 @@

_defineProperty(this, '_minWidth', function(width) {
_defineProperty(this, "_minWidth", function (width) {
return !width ? width : (0, _max.default)([_this.minWidth, width]);
});
_defineProperty(this, '_cache', function(name, fn) {
_defineProperty(this, "_cache", function (name, fn) {
if (name in _this._cached) {

@@ -357,3 +281,3 @@ return _this._cached[name];

_defineProperty(this, '_leafColumns', function(columns) {
_defineProperty(this, "_leafColumns", function (columns) {
var leafColumns = [];

@@ -367,6 +291,3 @@

} else {
leafColumns.push.apply(
leafColumns,
_toConsumableArray(_this._leafColumns(column.children))
);
leafColumns.push.apply(leafColumns, _toConsumableArray(_this._leafColumns(column.children)));
}

@@ -378,9 +299,6 @@ }

_defineProperty(this, '_groupColumns', function(columns) {
var currentRow =
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentColumn =
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var rows =
arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
_defineProperty(this, "_groupColumns", function (columns) {
var currentRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentColumn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
rows[currentRow] = rows[currentRow] || [];

@@ -392,8 +310,3 @@ var grouped = [];

if (
column &&
!column.children &&
rs > 1 &&
(!column[rowSpan] || column[rowSpan] < rs)
) {
if (column && !column.children && rs > 1 && (!column[rowSpan] || column[rowSpan] < rs)) {
column[rowSpan] = rs;

@@ -409,6 +322,3 @@ }

rows[currentRow].push(newColumn);
newColumn[path] = [].concat(
_toConsumableArray(parentColumn[path] || [currentRow]),
[index]
);
newColumn[path] = [].concat(_toConsumableArray(parentColumn[path] || [currentRow]), [index]);
newColumn[_pathKey] = newColumn[path].join('-');

@@ -419,8 +329,3 @@ newColumn[_currentRow] = currentRow;

if (newColumn.children && newColumn.children.length > 0) {
newColumn.children = _this._groupColumns(
newColumn.children,
currentRow + 1,
newColumn,
rows
);
newColumn.children = _this._groupColumns(newColumn.children, currentRow + 1, newColumn, rows);
parentColumn[colSpan] = parentColumn[colSpan] + newColumn[colSpan];

@@ -430,25 +335,10 @@ newColumn[_width] = (0, _sumBy.default)(newColumn.children, _width);

parentColumn[colSpan]++;
newColumn[_width] = _this._calcWidth(
newColumn.width,
_this.wrapperWidth
);
newColumn[_width] = _this._calcWidth(newColumn.width, _this.wrapperWidth);
if (
(0, _isNumber.default)(newColumn.minWidth) &&
!(0, _isNaN.default)(newColumn.minWidth)
) {
newColumn[_width] = (0, _max.default)([
newColumn[_width],
newColumn.minWidth
]);
if ((0, _isNumber.default)(newColumn.minWidth) && !(0, _isNaN.default)(newColumn.minWidth)) {
newColumn[_width] = (0, _max.default)([newColumn[_width], newColumn.minWidth]);
}
if (
(0, _isNumber.default)(newColumn.maxWidth) &&
!(0, _isNaN.default)(newColumn.maxWidth)
) {
newColumn[_width] = (0, _min.default)([
newColumn[_width],
newColumn.maxWidth
]);
if ((0, _isNumber.default)(newColumn.maxWidth) && !(0, _isNaN.default)(newColumn.maxWidth)) {
newColumn[_width] = (0, _min.default)([newColumn[_width], newColumn.maxWidth]);
}

@@ -474,13 +364,12 @@ }

_this.hasOverflowX =
_this.width > _this.wrapperWidth && _this.wrapperWidth !== 0;
_this.hasOverflowX = _this.width > _this.wrapperWidth && _this.wrapperWidth !== 0;
return grouped;
});
_defineProperty(this, '_updateWidth', function(columns) {
_defineProperty(this, "_updateWidth", function (columns) {
var wrapperWidth = _this.wrapperWidth || 0;
var leftColumns = columns.filter(function(c) {
var leftColumns = columns.filter(function (c) {
return c.fixed === true || c.fixed === 'left';
});
var rightColumns = columns.filter(function(c) {
var rightColumns = columns.filter(function (c) {
return c.fixed === 'right';

@@ -495,9 +384,7 @@ });

var len =
leafColumns.length - leftLeafColumns.length - rightLeafColumns.length;
var len = leafColumns.length - leftLeafColumns.length - rightLeafColumns.length;
var last;
var lcArr =
leafColumns.filter(function(c) {
return !c.fixed && c.fixed !== 'left' && c.fixed !== 'right';
}) || [];
var lcArr = leafColumns.filter(function (c) {
return !c.fixed && c.fixed !== 'left' && c.fixed !== 'right';
}) || [];

@@ -517,9 +404,6 @@ if (leafColumns.length > 0) {

_this.rightWidth = (0, _sumBy.default)(rightColumns, _width);
var average = (0, _max.default)([
(0, _floor.default)((wrapperWidth - baseWidth) / len),
0
]);
var average = (0, _max.default)([(0, _floor.default)((wrapperWidth - baseWidth) / len), 0]);
var update = function update(columns) {
return columns.map(function(column) {
return columns.map(function (column) {
var width = column[_width];

@@ -533,15 +417,9 @@ var children = column.children || [];

if (column[_pathKey] === last[_pathKey]) {
column[_width] = (0, _max.default)([
wrapperWidth - _this.leftWidth - _this.rightWidth - centerWidth,
column[_width]
]);
column[_width] = (0, _max.default)([wrapperWidth - _this.leftWidth - _this.rightWidth - centerWidth, column[_width]]);
} else {
if (
!leftColumns.some(function(c) {
return c[_pathKey] === column[_pathKey];
}) &&
!rightColumns.some(function(c) {
return c[_pathKey] === column[_pathKey];
})
) {
if (!leftColumns.some(function (c) {
return c[_pathKey] === column[_pathKey];
}) && !rightColumns.some(function (c) {
return c[_pathKey] === column[_pathKey];
})) {
column[_width] = width + average;

@@ -551,10 +429,4 @@ }

if (
(0, _isNumber.default)(column.maxWidth) &&
!(0, _isNaN.default)(column.maxWidth)
) {
column[_width] = (0, _min.default)([
column.maxWidth,
column[_width]
]);
if ((0, _isNumber.default)(column.maxWidth) && !(0, _isNaN.default)(column.maxWidth)) {
column[_width] = (0, _min.default)([column.maxWidth, column[_width]]);
}

@@ -566,5 +438,3 @@ }

if (column.fixed === 'left' || column.fixed === true) {
} else if (column.fixed === 'right') {
} else {
if (column.fixed === 'left' || column.fixed === true) {} else if (column.fixed === 'right') {} else {
centerWidth += column[_width];

@@ -591,2 +461,2 @@ }

exports.default = ColumnManager;
exports.default = ColumnManager;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,372 +8,296 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
var _findIndex = _interopRequireDefault(require('lodash/findIndex'));
var _findIndex = _interopRequireDefault(require("lodash/findIndex"));
var _types = require('../types');
var _types = require("../types");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) {
return (
_arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread()
);
}
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() {
throw new TypeError('Invalid attempt to spread non-iterable instance');
}
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) {
if (
Symbol.iterator in Object(iter) ||
Object.prototype.toString.call(iter) === '[object Arguments]'
)
return Array.from(iter);
}
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DataManager =
/*#__PURE__*/
(function() {
function DataManager(props) {
var _this = this;
/*#__PURE__*/
function () {
function DataManager(props) {
var _this = this;
_classCallCheck(this, DataManager);
_classCallCheck(this, DataManager);
_defineProperty(this, '_cached', {});
_defineProperty(this, "_cached", {});
_defineProperty(this, '_bodyHeight', 0);
_defineProperty(this, "_bodyHeight", 0);
_defineProperty(this, '_hasExpanded', false);
_defineProperty(this, "_hasExpanded", false);
_defineProperty(this, '_data', []);
_defineProperty(this, "_data", []);
_defineProperty(this, 'getData', function() {
return _this._cache('getData', function() {
return _this._getData(_this._data);
});
_defineProperty(this, "getData", function () {
return _this._cache('getData', function () {
return _this._getData(_this._data);
});
});
_defineProperty(this, 'getFixedData', function() {
return _this._cache('getFixedData', function() {
return _this._getFixedData(_this.showData());
});
_defineProperty(this, "getFixedData", function () {
return _this._cache('getFixedData', function () {
return _this._getFixedData(_this.showData());
});
});
_defineProperty(this, 'showData', function() {
return _this._cache('showData', function() {
return _this._showData(_this.getData());
});
_defineProperty(this, "showData", function () {
return _this._cache('showData', function () {
return _this._showData(_this.getData());
});
});
_defineProperty(this, 'fixedData', function() {
return _this._cache('fixedData', function() {
return _this._getFixedData(_this.showData());
});
_defineProperty(this, "fixedData", function () {
return _this._cache('fixedData', function () {
return _this._getFixedData(_this.showData());
});
});
_defineProperty(this, 'fixedDataLength', function() {
return _this._cache('fixedDataLength', function() {
return _this.fixedData().length;
});
_defineProperty(this, "fixedDataLength", function () {
return _this._cache('fixedDataLength', function () {
return _this.fixedData().length;
});
});
_defineProperty(this, 'isExpanded', function() {
return _this._cache('isExpanded', function() {
return _this.getData().some(function(d) {
return d.children && d.children.length > 0;
});
_defineProperty(this, "isExpanded", function () {
return _this._cache('isExpanded', function () {
return _this.getData().some(function (d) {
return d.children && d.children.length > 0;
});
});
});
_defineProperty(this, 'rowIsExpanded', function(record) {
return _this.expandedRowKeys.indexOf(record[_types.DS._key]) > -1;
});
_defineProperty(this, "rowIsExpanded", function (record) {
return _this.expandedRowKeys.indexOf(record[_types.DS._key]) > -1;
});
_defineProperty(this, 'isFixed', function(record) {
if ((record.children || []).length > 0) {
return false;
}
_defineProperty(this, "isFixed", function (record) {
if ((record.children || []).length > 0) {
return false;
}
return (
record['isFixed'] === true ||
record['isFixed'] === 'top' ||
record['isFixed'] === 'bottom'
);
return record['isFixed'] === true || record['isFixed'] === 'top' || record['isFixed'] === 'bottom';
});
_defineProperty(this, "reset", function (data) {
var _data = data || [];
_this._hasExpanded = _data.some(function (d) {
return !_this.isFixed(d) && (d.children || []).length > 0;
});
_defineProperty(this, 'reset', function(data) {
var _data = data || [];
if (!_this.fixedHeader) {
_this._data = _data;
} else {
var dataBase = _data.filter(function (d) {
var children = d.children || [];
return children.length > 0 || !_this.isFixed(d);
});
_this._hasExpanded = _data.some(function(d) {
return !_this.isFixed(d) && (d.children || []).length > 0;
var topData = _data.filter(function (d) {
var children = d.children || [];
return (d['isFixed'] === true || d['isFixed'] === 'top') && children.length === 0;
});
if (!_this.fixedHeader) {
_this._data = _data;
} else {
var dataBase = _data.filter(function(d) {
var children = d.children || [];
return children.length > 0 || !_this.isFixed(d);
});
var bottomData = _data.filter(function (d) {
var children = d.children || [];
return d['isFixed'] === 'bottom' && children.length === 0;
});
var topData = _data.filter(function(d) {
var children = d.children || [];
return (
(d['isFixed'] === true || d['isFixed'] === 'top') &&
children.length === 0
);
});
_this._data = [].concat(_toConsumableArray(topData), _toConsumableArray(dataBase), _toConsumableArray(bottomData));
}
var bottomData = _data.filter(function(d) {
var children = d.children || [];
return d['isFixed'] === 'bottom' && children.length === 0;
});
_this._bodyHeight = 0;
_this._cached = {};
_this._data = [].concat(
_toConsumableArray(topData),
_toConsumableArray(dataBase),
_toConsumableArray(bottomData)
);
}
_this.showData();
});
_this._bodyHeight = 0;
_this._cached = {};
_this.showData();
_defineProperty(this, "getByKey", function (key) {
var index = (0, _findIndex.default)(_this.showData(), function (d) {
return d[_types.DS._key] === key;
});
_defineProperty(this, 'getByKey', function(key) {
var index = (0, _findIndex.default)(_this.showData(), function(d) {
return d[_types.DS._key] === key;
});
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
return _this.showData()[index];
});
return _this.showData()[index];
});
_defineProperty(this, "resetExpandedRowKeys", function (keys) {
_this.expandedRowKeys = Array.from(new Set(keys));
delete _this._cached['getRowsHeight'];
delete _this._cached['showData'];
_defineProperty(this, 'resetExpandedRowKeys', function(keys) {
_this.expandedRowKeys = Array.from(new Set(keys));
delete _this._cached['getRowsHeight'];
delete _this._cached['showData'];
_this.showData();
_this.showData();
return _this.expandedRowKeys;
});
return _this.expandedRowKeys;
});
_defineProperty(this, "expanded", function (key) {
var keys = _this.expandedRowKeys || [];
_defineProperty(this, 'expanded', function(key) {
var keys = _this.expandedRowKeys || [];
if (keys.indexOf(key) < 0) {
keys.push(key);
} else {
keys = keys.filter(function (k) {
return key !== k;
});
}
if (keys.indexOf(key) < 0) {
keys.push(key);
} else {
keys = keys.filter(function(k) {
return key !== k;
});
}
_this.expandedRowKeys = Array.from(new Set(keys));
delete _this._cached['getRowsHeight'];
delete _this._cached['showData'];
_this.expandedRowKeys = Array.from(new Set(keys));
delete _this._cached['getRowsHeight'];
delete _this._cached['showData'];
_this.showData();
_this.showData();
return _this.expandedRowKeys;
});
return _this.expandedRowKeys;
});
_defineProperty(this, "_cache", function (name, fn) {
if (name in _this._cached) {
return _this._cached[name];
}
_defineProperty(this, '_cache', function(name, fn) {
if (name in _this._cached) {
return _this._cached[name];
}
_this._cached[name] = fn();
return _this._cached[name];
});
_this._cached[name] = fn();
return _this._cached[name];
});
_defineProperty(this, "_getData", function (dataSource) {
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentPath = arguments.length > 2 ? arguments[2] : undefined;
dataSource = dataSource || [];
_defineProperty(this, '_getData', function(dataSource) {
var level =
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentPath = arguments.length > 2 ? arguments[2] : undefined;
dataSource = dataSource || [];
for (var index = 0; index < dataSource.length; index++) {
var height = _this.getRowHeight(dataSource[index], index) * _this.rowHeight;
for (var index = 0; index < dataSource.length; index++) {
var height =
_this.getRowHeight(dataSource[index], index) * _this.rowHeight;
var path = "".concat(parentPath === undefined ? index : "".concat(parentPath, "-").concat(index));
var record = dataSource[index];
var children = record['children'] || [];
record[_types.DS._index] = index;
record[_types.DS._path] = path;
record[_types.DS._expandedLevel] = level;
record[_types.DS._height] = height;
record[_types.DS._key] = _this._rowKey(record, index);
record[_types.DS._expandedEnable] = children.length > 0;
var path = ''.concat(
parentPath === undefined
? index
: ''.concat(parentPath, '-').concat(index)
);
var record = dataSource[index];
var children = record['children'] || [];
record[_types.DS._index] = index;
record[_types.DS._path] = path;
record[_types.DS._expandedLevel] = level;
record[_types.DS._height] = height;
record[_types.DS._key] = _this._rowKey(record, index);
record[_types.DS._expandedEnable] = children.length > 0;
if (_this.isFixed(record)) {
record[_types.DS._isFixed] = record['isFixed'];
}
if (_this.isFixed(record)) {
record[_types.DS._isFixed] = record['isFixed'];
}
record[_types.DS._rowClassName] = _this._rowClassName(record, index, level);
record[_types.DS._rowClassName] = _this._rowClassName(
record,
index,
level
);
if (children.length > 0) {
record['children'] = _this._getData(children, level + 1, path);
}
if (children.length > 0) {
record['children'] = _this._getData(children, level + 1, path);
}
}
return dataSource;
});
return dataSource;
});
_defineProperty(this, '_getFixedData', function(data) {
return data.filter(function(d) {
return d['isFixed'] && (d.children || []).length === 0;
});
_defineProperty(this, "_getFixedData", function (data) {
return data.filter(function (d) {
return d['isFixed'] && (d.children || []).length === 0;
});
});
_defineProperty(this, '_showData', function(dataSource, data) {
dataSource = dataSource || [];
data = data || [];
_defineProperty(this, "_showData", function (dataSource, data) {
dataSource = dataSource || [];
data = data || [];
if (data.length === 0) {
_this._bodyHeight = 0;
}
if (data.length === 0) {
_this._bodyHeight = 0;
}
var expandedKeys = _this.expandedRowKeys || [];
var expandedKeys = _this.expandedRowKeys || [];
for (var index = 0; index < dataSource.length; index++) {
var record = dataSource[index];
record[_types.DS._showIndex] = data.length;
record[_types.DS._top] = _this._bodyHeight;
_this._bodyHeight += record[_types.DS._height];
var children = record.children || [];
for (var index = 0; index < dataSource.length; index++) {
var record = dataSource[index];
record[_types.DS._showIndex] = data.length;
record[_types.DS._top] = _this._bodyHeight;
_this._bodyHeight += record[_types.DS._height];
var children = record.children || [];
var _expanded =
expandedKeys.length > 0 &&
expandedKeys.indexOf(record[_types.DS._key]) > -1 &&
children.length > 0;
var _expanded = expandedKeys.length > 0 && expandedKeys.indexOf(record[_types.DS._key]) > -1 && children.length > 0;
record[_types.DS._expanded] = _expanded;
data.push(record);
record[_types.DS._expanded] = _expanded;
data.push(record);
if (_expanded) {
data = _this._showData(children, data);
}
if (_expanded) {
data = _this._showData(children, data);
}
}
return data;
});
return data;
});
_defineProperty(this, '_rowKey', function(record, index) {
var rowKey = _this.rowKey;
_defineProperty(this, "_rowKey", function (record, index) {
var rowKey = _this.rowKey;
if (typeof rowKey === 'function') {
return rowKey(record, index);
} else if (typeof rowKey === 'string') {
return record[rowKey];
} else if (record['key']) {
return record['key'];
}
if (typeof rowKey === 'function') {
return rowKey(record, index);
} else if (typeof rowKey === 'string') {
return record[rowKey];
} else if (record['key']) {
return record['key'];
}
return index;
});
return index;
});
_defineProperty(this, '_rowClassName', function(record, index, level) {
var _classNames;
_defineProperty(this, "_rowClassName", function (record, index, level) {
var _classNames;
var className = '';
var rowClassName = _this.rowClassName;
var className = '';
var rowClassName = _this.rowClassName;
if (typeof rowClassName === 'function') {
className = rowClassName(record, index);
} else if (rowClassName === 'string') {
className = rowClassName || '';
}
if (typeof rowClassName === 'function') {
className = rowClassName(record, index);
} else if (rowClassName === 'string') {
className = rowClassName || '';
}
return (0,
_classnames.default)('tr', ''.concat(_this.prefixCls, '-row'), className, ((_classNames = {}), _defineProperty(_classNames, ''.concat(_this.prefixCls, '-expanded-row-').concat(level), _this._hasExpanded), _defineProperty(_classNames, ''.concat(_this.prefixCls, '-row-fixed'), record[_types.DS._isFixed]), _classNames));
});
return (0, _classnames.default)('tr', "".concat(_this.prefixCls, "-row"), className, (_classNames = {}, _defineProperty(_classNames, "".concat(_this.prefixCls, "-expanded-row-").concat(level), _this._hasExpanded), _defineProperty(_classNames, "".concat(_this.prefixCls, "-row-fixed"), record[_types.DS._isFixed]), _classNames));
});
this.prefixCls = props.prefixCls;
this.getRowHeight = props.getRowHeight;
this.fixedHeader = props.fixedHeader;
this.rowHeight = props.rowHeight;
this.expandedRowKeys = props.expandedRowKeys || [];
this.rowKey = props.rowKey;
this.rowClassName = props.rowClassName;
this.reset(props.dataSource);
this.prefixCls = props.prefixCls;
this.getRowHeight = props.getRowHeight;
this.fixedHeader = props.fixedHeader;
this.rowHeight = props.rowHeight;
this.expandedRowKeys = props.expandedRowKeys || [];
this.rowKey = props.rowKey;
this.rowClassName = props.rowClassName;
this.reset(props.dataSource);
}
_createClass(DataManager, [{
key: "isEmpty",
value: function isEmpty() {
return this.getData().length === 0;
}
}]);
_createClass(DataManager, [
{
key: 'isEmpty',
value: function isEmpty() {
return this.getData().length === 0;
}
}
]);
return DataManager;
}();
return DataManager;
})();
exports.default = DataManager;
exports.default = DataManager;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,27 +8,9 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -39,52 +21,51 @@ var SizeManager = function SizeManager(_ref) {

var showHeader = _ref.showHeader,
footerHeight = _ref.footerHeight,
rowHeight = _ref.rowHeight,
footer = _ref.footer,
dataSource = _ref.dataSource,
useScrollY = _ref.useScrollY,
fixedHeader = _ref.fixedHeader;
footerHeight = _ref.footerHeight,
rowHeight = _ref.rowHeight,
footer = _ref.footer,
dataSource = _ref.dataSource,
useScrollY = _ref.useScrollY,
fixedHeader = _ref.fixedHeader;
_classCallCheck(this, SizeManager);
_defineProperty(this, '_dataWidth', 0);
_defineProperty(this, "_dataWidth", 0);
_defineProperty(this, '_dataHeight', 0);
_defineProperty(this, "_dataHeight", 0);
_defineProperty(this, '_wrapperWidth', 0);
_defineProperty(this, "_wrapperWidth", 0);
_defineProperty(this, '_wrapperHeight', 0);
_defineProperty(this, "_wrapperHeight", 0);
_defineProperty(this, '_leftWidth', 0);
_defineProperty(this, "_leftWidth", 0);
_defineProperty(this, '_rightWidth', 0);
_defineProperty(this, "_rightWidth", 0);
_defineProperty(this, '_headerWidth', 0);
_defineProperty(this, "_headerWidth", 0);
_defineProperty(this, '_headerHeight', 0);
_defineProperty(this, "_headerHeight", 0);
_defineProperty(this, '_scrollTop', 0);
_defineProperty(this, "_scrollTop", 0);
_defineProperty(this, '_scrollLeft', 0);
_defineProperty(this, "_scrollLeft", 0);
_defineProperty(this, '_startIndex', 0);
_defineProperty(this, "_startIndex", 0);
_defineProperty(this, '_stopIndex', 0);
_defineProperty(this, "_stopIndex", 0);
_defineProperty(this, '_scrollSizeY', 0);
_defineProperty(this, "_scrollSizeY", 0);
_defineProperty(this, '_scrollSizeX', 0);
_defineProperty(this, "_scrollSizeX", 0);
_defineProperty(this, '_showCount', 10);
_defineProperty(this, "_showCount", 10);
_defineProperty(this, '_hasScrollX', false);
_defineProperty(this, "_hasScrollX", false);
_defineProperty(this, '_hasScrollY', false);
_defineProperty(this, "_hasScrollY", false);
_defineProperty(this, '_dataEmpty', true);
_defineProperty(this, "_dataEmpty", true);
_defineProperty(this, '_clientBodyHeight', 0);
_defineProperty(this, "_clientBodyHeight", 0);
_defineProperty(this, 'update', function() {
var size =
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_defineProperty(this, "update", function () {
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -100,30 +81,21 @@ for (var key in size) {

_this._emptyTextHeight = _this._dataEmpty ? _this.rowHeight : 0;
_this._hasScrollY =
_this._wrapperHeight > 0 && _this._wrapperHeight < _this._totalHeight();
_this._hasScrollY = _this._wrapperHeight > 0 && _this._wrapperHeight < _this._totalHeight();
});
_defineProperty(this, 'clientBodyHeight', function() {
_defineProperty(this, "clientBodyHeight", function () {
var height = _this._wrapperHeight - _this.footerHeight;
height =
height -
(_this.showHeader && _this.fixedHeader ? _this._headerHeight : 0);
height = height - (_this.showHeader && _this.fixedHeader ? _this._headerHeight : 0);
_this._clientBodyHeight = height;
});
_defineProperty(this, 'scrollSizeX', function() {
_defineProperty(this, "scrollSizeX", function () {
return _this._hasScrollX ? _this._scrollSizeX : 0;
});
_defineProperty(this, 'scrollSizeY', function() {
_defineProperty(this, "scrollSizeY", function () {
return _this._hasScrollY ? _this._scrollSizeY : 0;
});
_defineProperty(this, '_totalHeight', function() {
return (
_this._dataHeight +
(_this.showHeader ? _this._headerHeight : 0) +
_this.footerHeight +
_this._emptyTextHeight +
(_this._hasScrollX && _this._scrollSizeY ? _this._scrollSizeY : 0)
);
_defineProperty(this, "_totalHeight", function () {
return _this._dataHeight + (_this.showHeader ? _this._headerHeight : 0) + _this.footerHeight + _this._emptyTextHeight + (_this._hasScrollX && _this._scrollSizeY ? _this._scrollSizeY : 0);
});

@@ -139,4 +111,3 @@

this._emptyTextHeight = this._dataEmpty ? rowHeight : 0;
this._hasScrollY =
this._wrapperHeight > 0 && this._wrapperHeight < this._totalHeight();
this._hasScrollY = this._wrapperHeight > 0 && this._wrapperHeight < this._totalHeight();
this.clientBodyHeight();

@@ -146,2 +117,2 @@ };

var _default = SizeManager;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,134 +8,97 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SortManager =
/*#__PURE__*/
(function() {
function SortManager(_ref) {
var _this = this;
/*#__PURE__*/
function () {
function SortManager(_ref) {
var _this = this;
var _columns = _ref.columns,
var _columns = _ref.columns,
_sortMulti = _ref.sortMulti;
_classCallCheck(this, SortManager);
_classCallCheck(this, SortManager);
_defineProperty(this, '_cached', {});
_defineProperty(this, "_cached", {});
_defineProperty(this, 'update', function(_ref2) {
var columns = _ref2.columns,
_defineProperty(this, "update", function (_ref2) {
var columns = _ref2.columns,
sortMulti = _ref2.sortMulti;
_this.columns = columns;
_this.sortMulti = sortMulti;
_this.enable = {};
_this.enable = _this._enable(columns);
});
_this.columns = columns;
_this.sortMulti = sortMulti;
_this.enable = {};
_this.enable = _this._enable(columns);
});
_defineProperty(this, '_enable', function(columns) {
var order =
arguments.length > 1 && arguments[1] !== undefined
? arguments[1]
: {};
_defineProperty(this, "_enable", function (columns) {
var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
for (var i = 0; i < columns.length; i++) {
var column = columns[i] || {};
var children = column.children || [];
for (var i = 0; i < columns.length; i++) {
var column = columns[i] || {};
var children = column.children || [];
if (children.length > 0) {
order = _this._enable(children, order);
} else {
if (column.sortEnable) {
order[column.dataIndex] = column.order;
}
if (children.length > 0) {
order = _this._enable(children, order);
} else {
if (column.sortEnable) {
order[column.dataIndex] = column.order;
}
}
}
return order;
});
return order;
});
this.columns = _columns;
this.sortMulti = _sortMulti;
this.enable = this._enable(_columns);
}
this.columns = _columns;
this.sortMulti = _sortMulti;
this.enable = this._enable(_columns);
}
_createClass(SortManager, [
{
key: 'enabled',
value: function enabled() {
var _this2 = this;
_createClass(SortManager, [{
key: "enabled",
value: function enabled() {
var _this2 = this;
return this._cache('enabled', function() {
return _this2.enable;
});
}
},
{
key: 'setOrder',
value: function setOrder(key, order, fn) {
if (!this.sortMulti) {
this.enable = _defineProperty({}, ''.concat(key), order);
}
return this._cache('enabled', function () {
return _this2.enable;
});
}
}, {
key: "setOrder",
value: function setOrder(key, order, fn) {
if (!this.sortMulti) {
this.enable = _defineProperty({}, "".concat(key), order);
}
this.enable[key] = order;
this.enable[key] = order;
if (typeof fn === 'function') {
fn(this.enable);
}
}
},
{
key: '_cache',
value: function _cache(name, fn) {
if (name in this._cached) {
return this._cached[name];
}
this._cached[name] = fn();
return this._cached[name];
}
if (typeof fn === 'function') {
fn(this.enable);
}
]);
}
}, {
key: "_cache",
value: function _cache(name, fn) {
if (name in this._cached) {
return this._cached[name];
}
return SortManager;
})();
this._cached[name] = fn();
return this._cached[name];
}
}]);
exports.default = SortManager;
return SortManager;
}();
exports.default = SortManager;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,132 +8,33 @@ });

var _react = require('react');
var _react = require("react");
var _shallowequal = _interopRequireDefault(require('shallowequal'));
var _shallowequal = _interopRequireDefault(require("shallowequal"));
var _hoistNonReactStatics = _interopRequireDefault(
require('hoist-non-react-statics')
);
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
var _PropTypes = require('./PropTypes');
var _PropTypes = require("./PropTypes");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -153,100 +54,77 @@ function getDisplayName(WrappedComponent) {

var Connect =
/*#__PURE__*/
(function(_Component) {
_inherits(Connect, _Component);
/*#__PURE__*/
function (_Component) {
_inherits(Connect, _Component);
function Connect(props, context) {
var _this;
function Connect(props, context) {
var _this;
_classCallCheck(this, Connect);
_classCallCheck(this, Connect);
_this = _possibleConstructorReturn(
this,
_getPrototypeOf(Connect).call(this, props, context)
);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Connect).call(this, props, context));
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleChange',
function() {
if (!_this.unsubscribe) {
return;
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleChange", function () {
if (!_this.unsubscribe) {
return;
}
var nextState = finnalMapStateToProps(
_this.store.getState(),
_this.props
);
var nextState = finnalMapStateToProps(_this.store.getState(), _this.props);
if (!(0, _shallowequal.default)(_this.nextState, nextState)) {
_this.nextState = nextState;
if (!(0, _shallowequal.default)(_this.nextState, nextState)) {
_this.nextState = nextState;
_this.setState({
subscribed: nextState
});
}
}
);
_this.setState({
subscribed: nextState
});
}
});
_this.store = context.miniStore;
_this.state = {
subscribed: finnalMapStateToProps(_this.store.getState(), props)
};
return _this;
_this.store = context.miniStore;
_this.state = {
subscribed: finnalMapStateToProps(_this.store.getState(), props)
};
return _this;
}
_createClass(Connect, [{
key: "componentDidMount",
value: function componentDidMount() {
this.trySubscribe();
}
_createClass(Connect, [
{
key: 'componentDidMount',
value: function componentDidMount() {
this.trySubscribe();
}
},
{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.tryUnsubscribe();
}
},
{
key: 'trySubscribe',
value: function trySubscribe() {
if (shouldSubscribe) {
this.unsubscribe = this.store.subscribe(this.handleChange);
this.handleChange();
}
}
},
{
key: 'tryUnsubscribe',
value: function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
}
},
{
key: 'render',
value: function render() {
return (0, _react.createElement)(
WrappedComponent,
_objectSpread({}, this.props, this.state.subscribed, {
store: this.store
})
);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.tryUnsubscribe();
}
}, {
key: "trySubscribe",
value: function trySubscribe() {
if (shouldSubscribe) {
this.unsubscribe = this.store.subscribe(this.handleChange);
this.handleChange();
}
]);
}
}, {
key: "tryUnsubscribe",
value: function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
}
}, {
key: "render",
value: function render() {
return (0, _react.createElement)(WrappedComponent, _objectSpread({}, this.props, this.state.subscribed, {
store: this.store
}));
}
}]);
return Connect;
})(_react.Component);
return Connect;
}(_react.Component);
_defineProperty(
Connect,
'displayName',
'Connect('.concat(getDisplayName(WrappedComponent), ')')
);
_defineProperty(Connect, "displayName", "Connect(".concat(getDisplayName(WrappedComponent), ")"));
_defineProperty(Connect, 'contextTypes', {
_defineProperty(Connect, "contextTypes", {
miniStore: _PropTypes.storeShape.isRequired

@@ -257,2 +135,2 @@ });

};
}
}

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,33 +8,5 @@ });

function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -70,2 +42,2 @@ function create(initialState) {

};
}
}

@@ -1,7 +0,7 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, 'Provider', {
Object.defineProperty(exports, "Provider", {
enumerable: true,

@@ -12,3 +12,3 @@ get: function get() {

});
Object.defineProperty(exports, 'connect', {
Object.defineProperty(exports, "connect", {
enumerable: true,

@@ -19,3 +19,3 @@ get: function get() {

});
Object.defineProperty(exports, 'create', {
Object.defineProperty(exports, "create", {
enumerable: true,

@@ -27,10 +27,8 @@ get: function get() {

var _Provider2 = _interopRequireDefault(require('./Provider'));
var _Provider2 = _interopRequireDefault(require("./Provider"));
var _connect2 = _interopRequireDefault(require('./connect'));
var _connect2 = _interopRequireDefault(require("./connect"));
var _create2 = _interopRequireDefault(require('./create'));
var _create2 = _interopRequireDefault(require("./create"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,7 +8,5 @@ });

var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -21,2 +19,2 @@ var storeShape = _propTypes.default.shape({

exports.storeShape = storeShape;
exports.storeShape = storeShape;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,172 +8,64 @@ });

var _react = _interopRequireWildcard(require('react'));
var _react = _interopRequireWildcard(require("react"));
var _PropTypes = require('./PropTypes');
var _PropTypes = require("./PropTypes");
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc =
Object.defineProperty && Object.getOwnPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: {};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Provider =
/*#__PURE__*/
(function(_Component) {
_inherits(Provider, _Component);
/*#__PURE__*/
function (_Component) {
_inherits(Provider, _Component);
function Provider() {
_classCallCheck(this, Provider);
function Provider() {
_classCallCheck(this, Provider);
return _possibleConstructorReturn(
this,
_getPrototypeOf(Provider).apply(this, arguments)
);
return _possibleConstructorReturn(this, _getPrototypeOf(Provider).apply(this, arguments));
}
_createClass(Provider, [{
key: "getChildContext",
value: function getChildContext() {
return {
miniStore: this.props.store
};
}
}, {
key: "render",
value: function render() {
return _react.Children.only(this.props.children);
}
}]);
_createClass(Provider, [
{
key: 'getChildContext',
value: function getChildContext() {
return {
miniStore: this.props.store
};
}
},
{
key: 'render',
value: function render() {
return _react.Children.only(this.props.children);
}
}
]);
return Provider;
}(_react.Component);
return Provider;
})(_react.Component);
exports.default = Provider;
_defineProperty(Provider, 'propTypes', {
_defineProperty(Provider, "propTypes", {
store: _PropTypes.storeShape.isRequired
});
_defineProperty(Provider, 'childContextTypes', {
_defineProperty(Provider, "childContextTypes", {
miniStore: _PropTypes.storeShape.isRequired
});
});

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,515 +8,315 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require('prop-types'));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _reactDom = require('react-dom');
var _reactDom = require("react-dom");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) {
if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj &&
typeof Symbol === 'function' &&
obj.constructor === Symbol &&
obj !== Symbol.prototype
? 'symbol'
: typeof obj;
};
}
return _typeof(obj);
}
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _toConsumableArray(arr) {
return (
_arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread()
);
}
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() {
throw new TypeError('Invalid attempt to spread non-iterable instance');
}
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) {
if (
Symbol.iterator in Object(iter) ||
Object.prototype.toString.call(iter) === '[object Arguments]'
)
return Array.from(iter);
}
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === 'object' || typeof call === 'function')) {
return call;
}
return _assertThisInitialized(self);
}
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function');
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {value: subClass, writable: true, configurable: true}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called"
);
}
return self;
}
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Children = _react.default.Children,
PureComponent = _react.default.PureComponent;
PureComponent = _react.default.PureComponent;
var Sortable =
/*#__PURE__*/
(function(_PureComponent) {
_inherits(Sortable, _PureComponent);
/*#__PURE__*/
function (_PureComponent) {
_inherits(Sortable, _PureComponent);
function Sortable(_props) {
var _this;
function Sortable(_props) {
var _this;
_classCallCheck(this, Sortable);
_classCallCheck(this, Sortable);
_this = _possibleConstructorReturn(
this,
_getPrototypeOf(Sortable).call(this, _props)
);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Sortable).call(this, _props));
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'currentEl',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "currentEl", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'cloneEl',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "cloneEl", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'parentEl',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "parentEl", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'dragAble',
false
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "dragAble", false);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'offsetX',
0
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "offsetX", 0);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'currentElIndex',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "currentElIndex", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'prevEl',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "prevEl", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'nextEl',
null
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "nextEl", null);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'propsToState',
function() {
var props =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: _this.props;
var showIndex = [];
var children = Children.map(props.children, function(child, index) {
showIndex.push(index);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "propsToState", function () {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props;
var showIndex = [];
var children = Children.map(props.children, function (child, index) {
showIndex.push(index);
if (child.props.fixed === 'left') {
_this.fixedIndex.push(index);
if (child.props.fixed === 'left') {
_this.fixedIndex.push(index);
_this.leftFixedIndex.push(index);
}
_this.leftFixedIndex.push(index);
}
if (child.props.fixed === 'right') {
_this.fixedIndex.push(index);
if (child.props.fixed === 'right') {
_this.fixedIndex.push(index);
_this.rightFixedIndex.push(index);
}
return _react.default.cloneElement(child, {
ref: _this.saveRef(index),
onMouseDown: _this.handleMouseDown,
'data-index': index
});
});
_this.backIndex = showIndex;
return {
showIndex: showIndex,
children: children
};
_this.rightFixedIndex.push(index);
}
);
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'saveRef',
function(index) {
return function(node) {
_this['child-'.concat(index)] = node;
};
}
);
return _react.default.cloneElement(child, {
ref: _this.saveRef(index),
onMouseDown: _this.handleMouseDown,
'data-index': index
});
});
_this.backIndex = showIndex;
return {
showIndex: showIndex,
children: children
};
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleMouseMove',
function(event) {
if (_this.dragAble) {
var left = event.pageX - _this.offsetX;
left = left < 0 ? 0 : left;
_this.cloneEl.style.left = ''.concat(left, 'px');
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "saveRef", function (index) {
return function (node) {
_this["child-".concat(index)] = node;
};
});
_this._swap();
}
}
);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseMove", function (event) {
if (_this.dragAble) {
var left = event.pageX - _this.offsetX;
left = left < 0 ? 0 : left;
_this.cloneEl.style.left = "".concat(left, "px");
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleMouseUp',
function(event) {
var _this$props = _this.props,
onDrag = _this$props.onDrag,
parent = _this$props.parent,
columns = _this$props.columns;
_this.dragAble = false;
_this._swap();
}
});
if (_this.cloneEl && _this.parentEl) {
_this.parentEl.removeChild(_this.cloneEl);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseUp", function (event) {
var _this$props = _this.props,
onDrag = _this$props.onDrag,
parent = _this$props.parent,
columns = _this$props.columns;
_this.dragAble = false;
_this.parentEl = null;
_this.cloneEl = null;
_this.currentEl.style.opacity = 1;
_this.currentEl.style.background = 'transparent';
_this.currentEl = null;
_this.currentElIndex = null;
_this.prevEl = null;
_this.nextEl = null;
_this.dataCurrentIndex = null;
_this.prevElIndex = null;
_this.nextElIndex = null;
}
if (_this.cloneEl && _this.parentEl) {
_this.parentEl.removeChild(_this.cloneEl);
document.body.style['user-select'] = 'text';
document.body.style['-ms-user-select'] = 'text';
document.body.style['-moz-user-select'] = 'text';
document.body.style['-webkit-user-select'] = 'text';
_this.parentEl = null;
_this.cloneEl = null;
_this.currentEl.style.opacity = 1;
_this.currentEl.style.background = 'transparent';
_this.currentEl = null;
_this.currentElIndex = null;
_this.prevEl = null;
_this.nextEl = null;
_this.dataCurrentIndex = null;
_this.prevElIndex = null;
_this.nextElIndex = null;
}
var dragChange = _this.state.showIndex.some(function(index, i) {
return _this.backIndex[i] !== index;
});
document.body.style['user-select'] = 'text';
document.body.style['-ms-user-select'] = 'text';
document.body.style['-moz-user-select'] = 'text';
document.body.style['-webkit-user-select'] = 'text';
if (dragChange && typeof onDrag === 'function') {
onDrag(
parent,
_this.state.showIndex.map(function(index) {
return columns[index];
})
);
}
}
);
var dragChange = _this.state.showIndex.some(function (index, i) {
return _this.backIndex[i] !== index;
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'handleMouseDown',
function(event) {
var headerSortable = _this.context.props.headerSortable;
if (dragChange && typeof onDrag === 'function') {
onDrag(parent, _this.state.showIndex.map(function (index) {
return columns[index];
}));
}
});
if (event.button !== 0) {
return event;
}
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleMouseDown", function (event) {
var headerSortable = _this.context.getProps('headerSortable');
if (!headerSortable) {
return;
}
if (event.button !== 0) {
return event;
}
_this.backIndex = _this.state.showIndex;
document.body.style['user-select'] = 'none';
document.body.style['-ms-user-select'] = 'none';
document.body.style['-moz-user-select'] = 'none';
document.body.style['-webkit-user-select'] = 'none';
_this.parentEl = event.currentTarget.parentNode;
_this.cloneEl = event.currentTarget.cloneNode(true);
_this.currentEl = event.currentTarget;
_this.currentEl.style.opacity = 0; // get current index
if (!headerSortable) {
return;
}
var index = _this.currentEl.getAttribute('data-index');
_this.backIndex = _this.state.showIndex;
document.body.style['user-select'] = 'none';
document.body.style['-ms-user-select'] = 'none';
document.body.style['-moz-user-select'] = 'none';
document.body.style['-webkit-user-select'] = 'none';
_this.parentEl = event.currentTarget.parentNode;
_this.cloneEl = event.currentTarget.cloneNode(true);
_this.currentEl = event.currentTarget;
_this.currentEl.style.opacity = 0; // get current index
_this.dataCurrentIndex = Number(index);
var index = _this.currentEl.getAttribute('data-index');
_this._both(); // clone current element
_this.dataCurrentIndex = Number(index);
var currentRect = _this.currentEl.getBoundingClientRect();
_this._both(); // clone current element
var parentRect = _this.parentEl.getBoundingClientRect();
_this.cloneEl.style.position = 'absolute';
_this.cloneEl.style.zIndex = 9999;
_this.cloneEl.style.background = '#393939';
_this.cloneEl.style.opacity = 0.8;
_this.cloneEl.style.left = ''.concat(
currentRect.left - (parentRect.left > 0 ? parentRect.left : 0),
'px'
);
_this.cloneEl.style.boxShadow = '0 0 10px rgba(0, 0, 0, .4)';
_this.offsetX =
event.pageX -
currentRect.left +
(parentRect.left > 0 ? parentRect.left : 0); // calc left max and min
var currentRect = _this.currentEl.getBoundingClientRect();
var left = 0;
var parentRect = _this.parentEl.getBoundingClientRect();
if (_this.leftFixedIndex > 0) {
_this.leftFixedIndex.forEach(function(i) {
var ele = (0, _reactDom.findDOMNode)(
_this['child-'.concat(i)]
).getBoundingClientRect();
left = left > ele.left + ele.width ? left : ele.left + ele.width;
});
}
_this.cloneEl.style.position = 'absolute';
_this.cloneEl.style.zIndex = 9999;
_this.cloneEl.style.background = '#393939';
_this.cloneEl.style.opacity = 0.8;
_this.cloneEl.style.left = "".concat(currentRect.left - (parentRect.left > 0 ? parentRect.left : 0), "px");
_this.cloneEl.style.boxShadow = '0 0 10px rgba(0, 0, 0, .4)';
_this.offsetX = event.pageX - currentRect.left + (parentRect.left > 0 ? parentRect.left : 0); // calc left max and min
_this.parentEl.appendChild(_this.cloneEl);
var left = 0;
_this.dragAble = true;
event.stopPropagation();
}
);
if (_this.leftFixedIndex > 0) {
_this.leftFixedIndex.forEach(function (i) {
var ele = (0, _reactDom.findDOMNode)(_this["child-".concat(i)]).getBoundingClientRect();
left = left > ele.left + ele.width ? left : ele.left + ele.width;
});
}
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_swap',
function() {
var cloneRect = _this.cloneEl.getBoundingClientRect();
_this.parentEl.appendChild(_this.cloneEl);
var nextRect, prevRect;
_this.dragAble = true;
event.stopPropagation();
});
if (_this.nextEl) {
nextRect = _this.nextEl.getBoundingClientRect();
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_swap", function () {
var cloneRect = _this.cloneEl.getBoundingClientRect();
if (
cloneRect.left + cloneRect.width >
nextRect.left + nextRect.width / 2
) {
// next swap
var showIndex = _toConsumableArray(_this.state.showIndex);
var nextRect, prevRect;
var temp = showIndex[_this.currentElIndex];
showIndex[_this.currentElIndex] = showIndex[_this.nextElIndex];
showIndex[_this.nextElIndex] = temp;
if (_this.nextEl) {
nextRect = _this.nextEl.getBoundingClientRect();
_this.setState(
{
showIndex: showIndex
},
_this._both
);
}
}
if (cloneRect.left + cloneRect.width > nextRect.left + nextRect.width / 2) {
// next swap
var showIndex = _toConsumableArray(_this.state.showIndex);
if (_this.prevEl) {
prevRect = _this.prevEl.getBoundingClientRect();
var temp = showIndex[_this.currentElIndex];
showIndex[_this.currentElIndex] = showIndex[_this.nextElIndex];
showIndex[_this.nextElIndex] = temp;
if (cloneRect.left < prevRect.left + prevRect.width / 2) {
// prev swap
var _showIndex = _toConsumableArray(_this.state.showIndex);
_this.setState({
showIndex: showIndex
}, _this._both);
}
}
var _temp = _showIndex[_this.currentElIndex];
_showIndex[_this.currentElIndex] = _showIndex[_this.prevElIndex];
_showIndex[_this.prevElIndex] = _temp;
if (_this.prevEl) {
prevRect = _this.prevEl.getBoundingClientRect();
_this.setState(
{
showIndex: _showIndex
},
_this._both
);
}
}
if (cloneRect.left < prevRect.left + prevRect.width / 2) {
// prev swap
var _showIndex = _toConsumableArray(_this.state.showIndex);
var _temp = _showIndex[_this.currentElIndex];
_showIndex[_this.currentElIndex] = _showIndex[_this.prevElIndex];
_showIndex[_this.prevElIndex] = _temp;
_this.setState({
showIndex: _showIndex
}, _this._both);
}
);
}
});
_defineProperty(
_assertThisInitialized(_assertThisInitialized(_this)),
'_both',
function() {
var showIndex = _this.state.showIndex;
_this.currentElIndex = showIndex.indexOf(_this.dataCurrentIndex);
_this.prevElIndex = _this.currentElIndex - 1;
_this.nextElIndex = _this.currentElIndex + 1;
_this.prevEl = null;
_this.nextEl = null;
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "_both", function () {
var showIndex = _this.state.showIndex;
_this.currentElIndex = showIndex.indexOf(_this.dataCurrentIndex);
_this.prevElIndex = _this.currentElIndex - 1;
_this.nextElIndex = _this.currentElIndex + 1;
_this.prevEl = null;
_this.nextEl = null;
if (
_this.prevElIndex >= 0 &&
(_this.fixedIndex.length === 0 ||
!_this.fixedIndex.some(function(i) {
return i === _this.prevElIndex;
}))
) {
// enable drag prev
_this.prevEl = (0, _reactDom.findDOMNode)(
_this['child-'.concat(showIndex[_this.prevElIndex])]
);
}
if (_this.prevElIndex >= 0 && (_this.fixedIndex.length === 0 || !_this.fixedIndex.some(function (i) {
return i === _this.prevElIndex;
}))) {
// enable drag prev
_this.prevEl = (0, _reactDom.findDOMNode)(_this["child-".concat(showIndex[_this.prevElIndex])]);
}
if (
_this.nextElIndex < showIndex.length &&
(_this.fixedIndex.length === 0 ||
!_this.fixedIndex.some(function(i) {
return i === _this.nextElIndex;
}))
) {
//enable drag next
_this.nextEl = (0, _reactDom.findDOMNode)(
_this['child-'.concat(showIndex[_this.nextElIndex])]
);
}
}
);
if (_this.nextElIndex < showIndex.length && (_this.fixedIndex.length === 0 || !_this.fixedIndex.some(function (i) {
return i === _this.nextElIndex;
}))) {
//enable drag next
_this.nextEl = (0, _reactDom.findDOMNode)(_this["child-".concat(showIndex[_this.nextElIndex])]);
}
});
_this.fixedIndex = [];
_this.leftFixedIndex = [];
_this.rightFixedIndex = [];
_this.state = _this.propsToState();
return _this;
_this.fixedIndex = [];
_this.leftFixedIndex = [];
_this.rightFixedIndex = [];
_this.state = _this.propsToState();
return _this;
}
_createClass(Sortable, [{
key: "componentDidMount",
value: function componentDidMount() {
document.addEventListener('mousemove', this.handleMouseMove);
document.addEventListener('mouseup', this.handleMouseUp);
}
_createClass(Sortable, [
{
key: 'componentDidMount',
value: function componentDidMount() {
document.addEventListener('mousemove', this.handleMouseMove);
document.addEventListener('mouseup', this.handleMouseUp);
}
},
{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.children !== this.props.children) {
this.setState(this.propsToState(nextProps));
}
}
},
{
key: 'render',
value: function render() {
var _this$state = this.state,
showIndex = _this$state.showIndex,
children = _this$state.children;
return showIndex.map(function(i) {
return children[i];
});
}
}, {
key: "componentWillReceiveProps",
value: function componentWillReceiveProps(nextProps) {
if (nextProps.children !== this.props.children) {
this.setState(this.propsToState(nextProps));
}
]);
}
}, {
key: "render",
value: function render() {
var _this$state = this.state,
showIndex = _this$state.showIndex,
children = _this$state.children;
return showIndex.map(function (i) {
return children[i];
});
}
}]);
return Sortable;
})(PureComponent);
return Sortable;
}(PureComponent);
_defineProperty(Sortable, 'contextTypes', {
_defineProperty(Sortable, "contextTypes", {
props: _propTypes.default.object,
updateScrollLeft: _propTypes.default.func
updateScrollLeft: _propTypes.default.func,
getProps: _propTypes.default.func
});
var _default = Sortable;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,9 +8,7 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,4 +22,4 @@ var Order = {

var onSort = props.onSort,
dataIndex = props.dataIndex,
prefixCls = props.prefixCls;
dataIndex = props.dataIndex,
prefixCls = props.prefixCls;
var order = props.order;

@@ -41,19 +39,13 @@

var wrapperCls = ''.concat(prefixCls, '-sorter');
var sortClass = (0, _classnames.default)(
''.concat(wrapperCls, '-').concat(order)
);
return _react.default.createElement(
'div',
{
className: wrapperCls,
onClick: onClick
},
_react.default.createElement('div', {
className: sortClass
})
);
var wrapperCls = "".concat(prefixCls, "-sorter");
var sortClass = (0, _classnames.default)("".concat(wrapperCls, "-").concat(order));
return _react.default.createElement("div", {
className: wrapperCls,
onClick: onClick
}, _react.default.createElement("div", {
className: sortClass
}));
}
var _default = Sorter;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,16 +8,14 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function Cell(props) {
var className = props.className,
ExpandedIcon = props.ExpandedIcon,
style = props.style,
children = props.children,
key = props.key;
ExpandedIcon = props.ExpandedIcon,
style = props.style,
children = props.children,
key = props.key;
var newProps = {

@@ -28,6 +26,6 @@ key: key,

};
return _react.default.createElement('div', newProps, ExpandedIcon, children);
return _react.default.createElement("div", newProps, ExpandedIcon, children);
}
var _default = Cell;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,24 +8,22 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _HeadCell = _interopRequireDefault(require('./HeadCell'));
var _HeadCell = _interopRequireDefault(require("./HeadCell"));
var _Sortable = _interopRequireDefault(require('./Sortable'));
var _Sortable = _interopRequireDefault(require("./Sortable"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function TableHeader(props) {
var columns = props.columns,
orders = props.orders,
onSort = props.onSort,
fixed = props.fixed,
headerRowHeight = props.headerRowHeight,
prefixCls = props.prefixCls,
onHeaderRow = props.onHeaderRow,
onDrag = props.onDrag;
var children = columns.map(function(column, index) {
orders = props.orders,
onSort = props.onSort,
fixed = props.fixed,
headerRowHeight = props.headerRowHeight,
prefixCls = props.prefixCls,
onHeaderRow = props.onHeaderRow,
onDrag = props.onDrag;
var children = columns.map(function (column, index) {
return (0, _HeadCell.default)({
key: 'HeadCol'.concat(index),
key: "HeadCol".concat(index),
column: column,

@@ -43,28 +41,16 @@ prefixCls: prefixCls,

if (!fixed) {
children = _react.default.createElement(
_Sortable.default,
{
columns: columns,
onDrag: onDrag
},
children
);
children = _react.default.createElement(_Sortable.default, {
columns: columns,
onDrag: onDrag
}, children);
}
return _react.default.createElement(
'div',
{
className: 'thead'
},
_react.default.createElement(
'div',
{
className: 'tr'
},
children
)
);
return _react.default.createElement("div", {
className: "thead"
}, _react.default.createElement("div", {
className: "tr"
}, children));
}
var _default = TableHeader;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,37 +8,20 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require('classnames'));
var _classnames = _interopRequireDefault(require("classnames"));
var _types = require('./types');
var _types = require("./types");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Row(props) {
var prefixCls = props.prefixCls,
hovered = props.hovered,
children = props.children,
style = props.style,
record = props.record,
key = props.key;
var rowClass = (0, _classnames.default)(
record[_types.DS._rowClassName],
_defineProperty({}, ''.concat(prefixCls, '-hover'), hovered)
);
hovered = props.hovered,
children = props.children,
style = props.style,
record = props.record,
key = props.key;
var rowClass = (0, _classnames.default)(record[_types.DS._rowClassName], _defineProperty({}, "".concat(prefixCls, "-hover"), hovered));
var newProps = {

@@ -51,3 +34,3 @@ key: key,

_types.rowEvents.forEach(function(event) {
_types.rowEvents.forEach(function (event) {
if (typeof props[event] === 'function') {

@@ -58,6 +41,6 @@ newProps[event] = props[event];

return _react.default.createElement('div', newProps, children);
return _react.default.createElement("div", newProps, children);
}
var _default = Row;
exports.default = _default;
exports.default = _default;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -8,7 +8,5 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -96,13 +94,3 @@ function defaultFunction() {

exports.DS = DS;
var rowEvents = [
'onMouseEnter',
'onMouseLeave',
'onClick',
'onDoubleClick',
'onBlur',
'onFocus',
'onAnimationStart',
'onAnimationEnd',
'onTransitionEnd'
];
var rowEvents = ['onMouseEnter', 'onMouseLeave', 'onClick', 'onDoubleClick', 'onBlur', 'onFocus', 'onAnimationStart', 'onAnimationEnd', 'onTransitionEnd'];
exports.rowEvents = rowEvents;

@@ -114,2 +102,2 @@ var eventsMap = {

};
exports.eventsMap = eventsMap;
exports.eventsMap = eventsMap;

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -22,32 +22,24 @@ });

if (!attachEvent) {
var requestFrame = (function() {
var raf =
_window.requestAnimationFrame ||
_window.mozRequestAnimationFrame ||
_window.webkitRequestAnimationFrame ||
function(fn) {
return _window.setTimeout(fn, 20);
};
var requestFrame = function () {
var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function (fn) {
return _window.setTimeout(fn, 20);
};
return function(fn) {
return function (fn) {
return raf(fn);
};
})();
}();
var cancelFrame = (function() {
var cancel =
_window.cancelAnimationFrame ||
_window.mozCancelAnimationFrame ||
_window.webkitCancelAnimationFrame ||
_window.clearTimeout;
return function(id) {
var cancelFrame = function () {
var cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout;
return function (id) {
return cancel(id);
};
})();
}();
var resetTriggers = function resetTriggers(element) {
var triggers = element.__resizeTriggers__,
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild;
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth;

@@ -62,6 +54,3 @@ contract.scrollTop = contract.scrollHeight;

var checkTriggers = function checkTriggers(element) {
return (
element.offsetWidth != element.__resizeLast__.width ||
element.offsetHeight != element.__resizeLast__.height
);
return element.offsetWidth != element.__resizeLast__.width || element.offsetHeight != element.__resizeLast__.height;
};

@@ -71,6 +60,3 @@

// Don't measure (which forces) reflow for scrolls that happen inside of children!
if (
e.target.className.indexOf('contract-trigger') < 0 &&
e.target.className.indexOf('expand-trigger') < 0
) {
if (e.target.className.indexOf('contract-trigger') < 0 && e.target.className.indexOf('expand-trigger') < 0) {
return;

@@ -86,3 +72,3 @@ }

this.__resizeRAF__ = requestFrame(function() {
this.__resizeRAF__ = requestFrame(function () {
if (checkTriggers(element)) {

@@ -92,3 +78,3 @@ element.__resizeLast__.width = element.offsetWidth;

element.__resizeListeners__.forEach(function(fn) {
element.__resizeListeners__.forEach(function (fn) {
fn.call(element, e);

@@ -101,10 +87,9 @@ });

var animation = false,
keyframeprefix = '',
animationstartevent = 'animationstart',
domPrefixes = 'Webkit Moz O ms'.split(' '),
startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(
' '
),
pfx = '';
keyframeprefix = '',
animationstartevent = 'animationstart',
domPrefixes = 'Webkit Moz O ms'.split(' '),
startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '),
pfx = '';
{

@@ -130,10 +115,4 @@ var elm = document.createElement('fakeelement');

var animationName = 'resizeanim';
var animationKeyframes =
'@' +
keyframeprefix +
'keyframes ' +
animationName +
' { from { opacity: 0; } to { opacity: 0; } } ';
var animationStyle =
keyframeprefix + 'animation: 1ms ' + animationName + '; ';
var animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } ';
var animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; ';
}

@@ -144,10 +123,5 @@

//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css =
(animationKeyframes ? animationKeyframes : '') +
'.resize-triggers { ' +
(animationStyle ? animationStyle : '') +
'visibility: hidden; opacity: 0; } ' +
'.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
head = doc.head || doc.getElementsByTagName('head')[0],
style = doc.createElement('style');
var css = (animationKeyframes ? animationKeyframes : '') + '.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
head = doc.head || doc.getElementsByTagName('head')[0],
style = doc.createElement('style');
style.id = 'detectElementResize';

@@ -186,7 +160,4 @@ style.type = 'text/css';

element.__resizeListeners__ = [];
(element.__resizeTriggers__ = doc.createElement('div')).className =
'resize-triggers';
element.__resizeTriggers__.innerHTML =
'<div class="expand-trigger"><div></div></div>' +
'<div class="contract-trigger"></div>';
(element.__resizeTriggers__ = doc.createElement('div')).className = 'resize-triggers';
element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div>' + '<div class="contract-trigger"></div>';
element.appendChild(element.__resizeTriggers__);

@@ -198,5 +169,3 @@ resetTriggers(element);

if (animationstartevent) {
element.__resizeTriggers__.__animationListener__ = function animationListener(
e
) {
element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
if (e.animationName == animationName) {

@@ -207,6 +176,3 @@ resetTriggers(element);

element.__resizeTriggers__.addEventListener(
animationstartevent,
element.__resizeTriggers__.__animationListener__
);
element.__resizeTriggers__.addEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__);
}

@@ -223,6 +189,3 @@ }

} else {
element.__resizeListeners__.splice(
element.__resizeListeners__.indexOf(fn),
1
);
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);

@@ -233,6 +196,3 @@ if (!element.__resizeListeners__.length) {

if (element.__resizeTriggers__.__animationListener__) {
element.__resizeTriggers__.removeEventListener(
animationstartevent,
element.__resizeTriggers__.__animationListener__
);
element.__resizeTriggers__.removeEventListener(animationstartevent, element.__resizeTriggers__.__animationListener__);

@@ -243,7 +203,4 @@ element.__resizeTriggers__.__animationListener__ = null;

try {
element.__resizeTriggers__ = !element.removeChild(
element.__resizeTriggers__
);
} catch (e) {
// Preact compat; see developit/preact-compat/issues/228
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
} catch (e) {// Preact compat; see developit/preact-compat/issues/228
}

@@ -258,2 +215,2 @@ }

};
}
}

@@ -1,4 +0,4 @@

'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
Object.defineProperty(exports, "__esModule", {
value: true

@@ -12,7 +12,5 @@ });

var _react = _interopRequireDefault(require('react'));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -30,6 +28,3 @@ var scrollbarSize;

function measureScrollbar() {
var direction =
arguments.length > 0 && arguments[0] !== undefined
? arguments[0]
: 'vertical';
var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'vertical';

@@ -49,3 +44,3 @@ if (typeof document === 'undefined' || typeof window === 'undefined') {

var scrollDiv = document.createElement('div');
Object.keys(scrollbarMeasure).forEach(function(scrollProp) {
Object.keys(scrollbarMeasure).forEach(function (scrollProp) {
scrollDiv.style[scrollProp] = scrollbarMeasure[scrollProp];

@@ -98,7 +93,3 @@ }); // Append related overflow style

function isInvalidRenderCellText(text) {
return (
text &&
!_react.default.isValidElement(text) &&
Object.prototype.toString.call(text) === '[object Object]'
);
return text && !_react.default.isValidElement(text) && Object.prototype.toString.call(text) === '[object Object]';
}

@@ -112,2 +103,2 @@

return Object.keys(obj || {}) || [];
}
}
{
"name": "fast-table",
"version": "1.4.6",
"version": "1.4.7-beta.0",
"description": "react table fast",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -0,0 +0,0 @@ import React from 'react';

@@ -0,0 +0,0 @@ import React from 'react';

@@ -0,0 +0,0 @@ import React from 'react';

@@ -31,3 +31,4 @@ import React from 'react';

updateScrollLeft: PropTypes.func,
update: PropTypes.func
update: PropTypes.func,
getProps: PropTypes.func
};

@@ -84,3 +85,4 @@

updateScrollLeft: this.updateScrollLeft,
update: this.updateAll
update: this.updateAll,
getProps: this.getProps
};

@@ -130,2 +132,6 @@ }

getProps = (prop) => {
return this.props[prop];
};
getShowCount = () => {

@@ -132,0 +138,0 @@ const {showHeader} = this.props;

@@ -25,3 +25,4 @@ import React from 'react';

props: PropTypes.object,
updateScrollLeft: PropTypes.func
updateScrollLeft: PropTypes.func,
getProps: PropTypes.func
};

@@ -113,3 +114,3 @@

handleMouseDown = (event) => {
const {headerSortable} = this.context.props;
const headerSortable = this.context.getProps('headerSortable');
if (event.button !== 0) {

@@ -116,0 +117,0 @@ return event;

@@ -0,0 +0,0 @@ import React from 'react';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc