fix(滚动时不实时render):
This commit is contained in:
commit
bfc084d5fd
|
@ -14,6 +14,10 @@ var _propTypes = require('prop-types');
|
||||||
|
|
||||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||||
|
|
||||||
|
var _componentClasses = require('component-classes');
|
||||||
|
|
||||||
|
var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
||||||
|
|
||||||
var _TableRow = require('./TableRow');
|
var _TableRow = require('./TableRow');
|
||||||
|
|
||||||
var _TableRow2 = _interopRequireDefault(_TableRow);
|
var _TableRow2 = _interopRequireDefault(_TableRow);
|
||||||
|
@ -1034,17 +1038,21 @@ var Table = function (_Component) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
||||||
|
var position = '';
|
||||||
if (e.target === bodyTable && headTable) {
|
if (e.target === bodyTable && headTable) {
|
||||||
headTable.scrollLeft = e.target.scrollLeft;
|
headTable.scrollLeft = e.target.scrollLeft;
|
||||||
} else if (e.target === headTable && bodyTable) {
|
} else if (e.target === headTable && bodyTable) {
|
||||||
bodyTable.scrollLeft = e.target.scrollLeft;
|
bodyTable.scrollLeft = e.target.scrollLeft;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft === 0) {
|
if (e.target.scrollLeft === 0) {
|
||||||
this.setState({ scrollPosition: 'left' });
|
position = 'left';
|
||||||
} else if (e.target.scrollLeft + 1 >= e.target.children[0].getBoundingClientRect().width - e.target.getBoundingClientRect().width) {
|
} else if (e.target.scrollLeft + 1 >= e.target.children[0].getBoundingClientRect().width - e.target.getBoundingClientRect().width) {
|
||||||
this.setState({ scrollPosition: 'right' });
|
position = 'right';
|
||||||
} else if (this.state.scrollPosition !== 'middle') {
|
} else if (this.state.scrollPosition !== 'middle') {
|
||||||
this.setState({ scrollPosition: 'middle' });
|
position = 'middle';
|
||||||
|
}
|
||||||
|
if (position) {
|
||||||
|
(0, _componentClasses2["default"])(this.contentTable).remove(new RegExp('^' + prefixCls + '-scroll-position-.+$')).add(prefixCls + '-scroll-position-' + position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scroll.y) {
|
if (scroll.y) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7237,7 +7237,7 @@
|
||||||
duration: _propTypes2["default"].number,
|
duration: _propTypes2["default"].number,
|
||||||
onClose: _propTypes2["default"].func,
|
onClose: _propTypes2["default"].func,
|
||||||
children: _propTypes2["default"].any,
|
children: _propTypes2["default"].any,
|
||||||
color: _propTypes2["default"].oneOf(['info', 'success', 'danger', 'warning', 'light', 'dark', 'news', 'infolight', 'successlight', 'dangerlight', 'warninglight']),
|
color: _propTypes2["default"].oneOf(['light']),
|
||||||
title: _propTypes2["default"].any
|
title: _propTypes2["default"].any
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7336,7 +7336,7 @@
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
Notice.propTypes = propTypes;
|
Notice.PropTypes = _propTypes2["default"];
|
||||||
Notice.defaultProps = defaultProps;
|
Notice.defaultProps = defaultProps;
|
||||||
|
|
||||||
exports["default"] = Notice;
|
exports["default"] = Notice;
|
||||||
|
@ -10582,6 +10582,10 @@
|
||||||
|
|
||||||
var _propTypes2 = _interopRequireDefault(_propTypes);
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
||||||
|
|
||||||
|
var _componentClasses = __webpack_require__(46);
|
||||||
|
|
||||||
|
var _componentClasses2 = _interopRequireDefault(_componentClasses);
|
||||||
|
|
||||||
var _TableRow = __webpack_require__(106);
|
var _TableRow = __webpack_require__(106);
|
||||||
|
|
||||||
var _TableRow2 = _interopRequireDefault(_TableRow);
|
var _TableRow2 = _interopRequireDefault(_TableRow);
|
||||||
|
@ -11602,18 +11606,24 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
||||||
|
var position = '';
|
||||||
if (e.target === bodyTable && headTable) {
|
if (e.target === bodyTable && headTable) {
|
||||||
headTable.scrollLeft = e.target.scrollLeft;
|
headTable.scrollLeft = e.target.scrollLeft;
|
||||||
} else if (e.target === headTable && bodyTable) {
|
} else if (e.target === headTable && bodyTable) {
|
||||||
bodyTable.scrollLeft = e.target.scrollLeft;
|
bodyTable.scrollLeft = e.target.scrollLeft;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft === 0) {
|
if (e.target.scrollLeft === 0) {
|
||||||
this.setState({ scrollPosition: 'left' });
|
position = 'left';
|
||||||
} else if (e.target.scrollLeft + 1 >= e.target.children[0].getBoundingClientRect().width - e.target.getBoundingClientRect().width) {
|
} else if (e.target.scrollLeft + 1 >= e.target.children[0].getBoundingClientRect().width - e.target.getBoundingClientRect().width) {
|
||||||
this.setState({ scrollPosition: 'right' });
|
position = 'right';
|
||||||
} else if (this.state.scrollPosition !== 'middle') {
|
} else if (this.state.scrollPosition !== 'middle') {
|
||||||
this.setState({ scrollPosition: 'middle' });
|
position = 'middle';
|
||||||
}
|
}
|
||||||
|
// if(position){
|
||||||
|
// classes(this.contentTable)
|
||||||
|
// .remove(new RegExp(`^${prefixCls}-scroll-position-.+$`))
|
||||||
|
// .add(`${prefixCls}-scroll-position-${position}`);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
if (scroll.y) {
|
if (scroll.y) {
|
||||||
if (fixedColumnsBodyLeft && e.target !== fixedColumnsBodyLeft) {
|
if (fixedColumnsBodyLeft && e.target !== fixedColumnsBodyLeft) {
|
||||||
|
@ -12983,8 +12993,13 @@
|
||||||
|
|
||||||
|
|
||||||
TableHeader.prototype.clearDragBorder = function clearDragBorder() {
|
TableHeader.prototype.clearDragBorder = function clearDragBorder() {
|
||||||
|
<<<<<<< HEAD
|
||||||
// if (!this.props.dragborder || !this.props.draggable) return;
|
// if (!this.props.dragborder || !this.props.draggable) return;
|
||||||
if (!this.drag) return;
|
if (!this.drag) return;
|
||||||
|
=======
|
||||||
|
if (!this.props.dragborder) return;
|
||||||
|
|
||||||
|
>>>>>>> ne-drag
|
||||||
this.drag = {
|
this.drag = {
|
||||||
option: ""
|
option: ""
|
||||||
};
|
};
|
||||||
|
@ -21620,7 +21635,7 @@
|
||||||
InputNumber.prototype.ComponentWillMount = function ComponentWillMount() {};
|
InputNumber.prototype.ComponentWillMount = function ComponentWillMount() {};
|
||||||
|
|
||||||
InputNumber.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
InputNumber.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
||||||
if (!nextProps.hasOwnProperty('precision')) {
|
// if(!nextProps.hasOwnProperty('precision')){//如果没有 precision
|
||||||
var data = judgeValue(nextProps);
|
var data = judgeValue(nextProps);
|
||||||
this.setState({
|
this.setState({
|
||||||
value: data.value,
|
value: data.value,
|
||||||
|
@ -21628,7 +21643,7 @@
|
||||||
plusDisabled: data.plusDisabled
|
plusDisabled: data.plusDisabled
|
||||||
});
|
});
|
||||||
this.tempStorage = data.value;
|
this.tempStorage = data.value;
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
InputNumber.prototype.ComponentWillUnMount = function ComponentWillUnMount() {
|
InputNumber.prototype.ComponentWillUnMount = function ComponentWillUnMount() {
|
||||||
|
@ -59411,18 +59426,18 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Popconfirm.prototype.handleClose = function handleClose(e) {
|
Popconfirm.prototype.handleClose = function handleClose() {
|
||||||
var onClose = this.props.onClose;
|
var onClose = this.props.onClose;
|
||||||
|
|
||||||
this.hide();
|
this.hide();
|
||||||
onClose && onClose(e);
|
onClose && onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
Popconfirm.prototype.handleCancel = function handleCancel(e) {
|
Popconfirm.prototype.handleCancel = function handleCancel() {
|
||||||
var onCancel = this.props.onCancel;
|
var onCancel = this.props.onCancel;
|
||||||
|
|
||||||
this.hide();
|
this.hide();
|
||||||
onCancel && onCancel(e);
|
onCancel && onCancel();
|
||||||
};
|
};
|
||||||
|
|
||||||
Popconfirm.prototype.handleHide = function handleHide() {
|
Popconfirm.prototype.handleHide = function handleHide() {
|
||||||
|
@ -59458,8 +59473,7 @@
|
||||||
content = _props.content,
|
content = _props.content,
|
||||||
children = _props.children,
|
children = _props.children,
|
||||||
onClick = _props.onClick,
|
onClick = _props.onClick,
|
||||||
stopbubble = _props.stopbubble,
|
props = _objectWithoutProperties(_props, ['content', 'children', 'onClick']);
|
||||||
props = _objectWithoutProperties(_props, ['content', 'children', 'onClick', 'stopbubble']);
|
|
||||||
|
|
||||||
delete props.defaultOverlayShown;
|
delete props.defaultOverlayShown;
|
||||||
|
|
||||||
|
@ -59476,7 +59490,6 @@
|
||||||
_extends({}, confirmProps, {
|
_extends({}, confirmProps, {
|
||||||
onClose: this.handleClose,
|
onClose: this.handleClose,
|
||||||
onCancel: this.handleCancel,
|
onCancel: this.handleCancel,
|
||||||
stopbubble: stopbubble,
|
|
||||||
placement: props.placement }),
|
placement: props.placement }),
|
||||||
content
|
content
|
||||||
);
|
);
|
||||||
|
@ -59591,11 +59604,6 @@
|
||||||
*/
|
*/
|
||||||
arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
arrowOffsetLeft: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
|
||||||
|
|
||||||
/**
|
|
||||||
* 阻止冒泡
|
|
||||||
*/
|
|
||||||
stopbubble: _propTypes2["default"].number,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title content
|
* Title content
|
||||||
*/
|
*/
|
||||||
|
@ -59606,7 +59614,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultProps = {
|
var defaultProps = {
|
||||||
stopbubble: 0,
|
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
clsPrefix: 'u-popconfirm',
|
clsPrefix: 'u-popconfirm',
|
||||||
locale: {}
|
locale: {}
|
||||||
|
@ -59618,27 +59625,7 @@
|
||||||
function Confirm(props) {
|
function Confirm(props) {
|
||||||
_classCallCheck(this, Confirm);
|
_classCallCheck(this, Confirm);
|
||||||
|
|
||||||
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
return _possibleConstructorReturn(this, _React$Component.call(this, props));
|
||||||
|
|
||||||
_this.cancel = function (e) {
|
|
||||||
var _this$props = _this.props,
|
|
||||||
stopbubble = _this$props.stopbubble,
|
|
||||||
onCancel = _this$props.onCancel;
|
|
||||||
|
|
||||||
stopbubble && e.stopPropagation();
|
|
||||||
onCancel(e);
|
|
||||||
};
|
|
||||||
|
|
||||||
_this.close = function (e) {
|
|
||||||
var _this$props2 = _this.props,
|
|
||||||
stopbubble = _this$props2.stopbubble,
|
|
||||||
onClose = _this$props2.onClose;
|
|
||||||
|
|
||||||
stopbubble && e.stopPropagation();
|
|
||||||
onClose(e);
|
|
||||||
};
|
|
||||||
|
|
||||||
return _this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Confirm.prototype.render = function render() {
|
Confirm.prototype.render = function render() {
|
||||||
|
@ -59660,8 +59647,7 @@
|
||||||
onClose = _props.onClose,
|
onClose = _props.onClose,
|
||||||
color = _props.color,
|
color = _props.color,
|
||||||
onCancel = _props.onCancel,
|
onCancel = _props.onCancel,
|
||||||
stopbubble = _props.stopbubble,
|
props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'clsPrefix', 'trigger', 'title', 'className', 'style', 'children', 'locale', 'onClose', 'color', 'onCancel']);
|
||||||
props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'clsPrefix', 'trigger', 'title', 'className', 'style', 'children', 'locale', 'onClose', 'color', 'onCancel', 'stopbubble']);
|
|
||||||
|
|
||||||
var local = (0, _tool.getComponentLocale)(this.props, this.context, 'Popconfirm', function () {
|
var local = (0, _tool.getComponentLocale)(this.props, this.context, 'Popconfirm', function () {
|
||||||
return _i18n2["default"];
|
return _i18n2["default"];
|
||||||
|
@ -59687,10 +59673,7 @@
|
||||||
_extends({}, props, {
|
_extends({}, props, {
|
||||||
role: 'tooltip',
|
role: 'tooltip',
|
||||||
className: (0, _classnames2["default"])(className, classes),
|
className: (0, _classnames2["default"])(className, classes),
|
||||||
style: outerStyle,
|
style: outerStyle
|
||||||
onClick: function onClick(e) {
|
|
||||||
return stopbubble && e.stopPropagation();
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
_react2["default"].createElement('div', { className: 'arrow', style: arrowStyle }),
|
_react2["default"].createElement('div', { className: 'arrow', style: arrowStyle }),
|
||||||
_react2["default"].createElement(
|
_react2["default"].createElement(
|
||||||
|
@ -59703,13 +59686,13 @@
|
||||||
{ className: (0, _classnames2["default"])(clsPrefix + '-confirm') },
|
{ className: (0, _classnames2["default"])(clsPrefix + '-confirm') },
|
||||||
_react2["default"].createElement(
|
_react2["default"].createElement(
|
||||||
_beeButton2["default"],
|
_beeButton2["default"],
|
||||||
{ onClick: this.cancel, size: 'sm', style: { minWidth: 50 },
|
{ onClick: onCancel, size: 'sm', style: { minWidth: 50 },
|
||||||
shape: 'border' },
|
shape: 'border' },
|
||||||
local['cancel']
|
local['cancel']
|
||||||
),
|
),
|
||||||
_react2["default"].createElement(
|
_react2["default"].createElement(
|
||||||
_beeButton2["default"],
|
_beeButton2["default"],
|
||||||
{ onClick: this.close, size: 'sm', style: { minWidth: 50 }, colors: 'primary' },
|
{ onClick: onClose, size: 'sm', style: { minWidth: 50 }, colors: 'primary' },
|
||||||
local['ok']
|
local['ok']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.6.2",
|
"version": "1.6.3",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
@ -64,6 +64,7 @@
|
||||||
"shallowequal": "^1.0.2",
|
"shallowequal": "^1.0.2",
|
||||||
"throttle-debounce": "^2.0.1",
|
"throttle-debounce": "^2.0.1",
|
||||||
"tinper-bee-core": "latest",
|
"tinper-bee-core": "latest",
|
||||||
|
"component-classes": "^1.2.6",
|
||||||
"warning": "^3.0.0"
|
"warning": "^3.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|
14
src/Table.js
14
src/Table.js
|
@ -1,5 +1,6 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classes from 'component-classes';
|
||||||
import TableRow from './TableRow';
|
import TableRow from './TableRow';
|
||||||
import TableHeader from './TableHeader';
|
import TableHeader from './TableHeader';
|
||||||
import { measureScrollbar, debounce, warningOnce ,getMaxColChildrenLength} from './utils';
|
import { measureScrollbar, debounce, warningOnce ,getMaxColChildrenLength} from './utils';
|
||||||
|
@ -906,20 +907,27 @@ class Table extends Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
if (e.target.scrollLeft !== this.lastScrollLeft) {
|
||||||
|
let position = '';
|
||||||
if (e.target === bodyTable && headTable) {
|
if (e.target === bodyTable && headTable) {
|
||||||
headTable.scrollLeft = e.target.scrollLeft;
|
headTable.scrollLeft = e.target.scrollLeft;
|
||||||
} else if (e.target === headTable && bodyTable) {
|
} else if (e.target === headTable && bodyTable) {
|
||||||
bodyTable.scrollLeft = e.target.scrollLeft;
|
bodyTable.scrollLeft = e.target.scrollLeft;
|
||||||
}
|
}
|
||||||
if (e.target.scrollLeft === 0) {
|
if (e.target.scrollLeft === 0) {
|
||||||
this.setState({ scrollPosition: 'left' });
|
position='left';
|
||||||
} else if (e.target.scrollLeft + 1 >=
|
} else if (e.target.scrollLeft + 1 >=
|
||||||
e.target.children[0].getBoundingClientRect().width -
|
e.target.children[0].getBoundingClientRect().width -
|
||||||
e.target.getBoundingClientRect().width) {
|
e.target.getBoundingClientRect().width) {
|
||||||
this.setState({ scrollPosition: 'right' });
|
position='right';
|
||||||
} else if (this.state.scrollPosition !== 'middle') {
|
} else if (this.state.scrollPosition !== 'middle') {
|
||||||
this.setState({ scrollPosition: 'middle' });
|
position='middle';
|
||||||
}
|
}
|
||||||
|
if(position){
|
||||||
|
classes(this.contentTable)
|
||||||
|
.remove(new RegExp(`^${prefixCls}-scroll-position-.+$`))
|
||||||
|
.add(`${prefixCls}-scroll-position-${position}`);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (scroll.y) {
|
if (scroll.y) {
|
||||||
if (fixedColumnsBodyLeft && e.target !== fixedColumnsBodyLeft) {
|
if (fixedColumnsBodyLeft && e.target !== fixedColumnsBodyLeft) {
|
||||||
|
|
Loading…
Reference in New Issue