shineout 2.0.4 → 2.0.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -372,8 +372,8 @@ function (_PureComponent) {
372
372
  }
373
373
 
374
374
  if (focus === true) {
375
- this.firstRender = true; // this.props.onFocus()
376
-
375
+ // this.firstRender = true
376
+ // this.props.onFocus()
377
377
  this.bindClickAway();
378
378
  } else {
379
379
  this.props.onValueBlur();
@@ -621,7 +621,8 @@ function (_PureComponent) {
621
621
  _proto.renderPicker = function renderPicker() {
622
622
  var _this9 = this;
623
623
 
624
- if (!this.firstRender) return undefined;
624
+ if (!this.firstRender && !this.focus) return undefined;
625
+ this.firstRender = true;
625
626
  var _this$props8 = this.props,
626
627
  range = _this$props8.range,
627
628
  type = _this$props8.type,
@@ -16,6 +16,7 @@ declare class SimpleTable<DataItem, Value> extends PureComponent<SimpleTableProp
16
16
  header: HTMLDivElement;
17
17
  footer: HTMLDivElement;
18
18
  lastColGroup: number[];
19
+ cyclicCounter: number;
19
20
  constructor(props: SimpleTableProps<DataItem, Value>);
20
21
  componentDidMount(): void;
21
22
  componentDidUpdate(prevProps: SimpleTableProps<DataItem, Value>): void;
@@ -58,6 +58,7 @@ function (_PureComponent) {
58
58
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "header", void 0);
59
59
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "footer", void 0);
60
60
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "lastColGroup", void 0);
61
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "cyclicCounter", void 0);
61
62
  _this.state = {
62
63
  colgroup: undefined,
63
64
  overHeight: false,
@@ -70,7 +71,10 @@ function (_PureComponent) {
70
71
  _this.bindFooter = _this.bindElement.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), 'footer');
71
72
  _this.handleScroll = _this.handleScroll.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
72
73
  _this.handleColgroup = _this.handleColgroup.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
73
- _this.resetColGroup = _this.resetColGroup.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
74
+ _this.resetColGroup = _this.resetColGroup.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); // 循环计数器。某些情况[*]下滚动条的出现会导致死循环问题,这里做一个计数器,超过一定次数就不再重置,认定最大 10 次为死循环
75
+ // [*] 横向滚动条的出现可能导致竖向滚动条从有到无。此时需要重新计算表头的宽度,否则会出现表头与表格内容不对齐的问题。纵向滚动条消失后,可能导致横向滚动条宽度足够,纵向滚动条再次出现,又导致横向滚动条消失,如此循环。
76
+
77
+ _this.cyclicCounter = 0;
74
78
  return _this;
75
79
  }
76
80
 
@@ -125,7 +129,17 @@ function (_PureComponent) {
125
129
  };
126
130
 
127
131
  _proto.scrollCheck = function scrollCheck() {
132
+ var _this2 = this;
133
+
128
134
  if (!this.body) return;
135
+
136
+ if (this.cyclicCounter > 10) {
137
+ this.setState({
138
+ overHeight: true
139
+ });
140
+ return;
141
+ }
142
+
129
143
  var overHeight = this.body.scrollHeight > this.body.clientHeight;
130
144
  var overWidth = this.body.scrollWidth > this.body.clientWidth;
131
145
  if (overWidth !== this.state.overWidth) this.setState({
@@ -134,6 +148,10 @@ function (_PureComponent) {
134
148
  if (overHeight !== this.state.overHeight) this.setState({
135
149
  overHeight: overHeight
136
150
  });
151
+ this.cyclicCounter += 1;
152
+ setTimeout(function () {
153
+ _this2.cyclicCounter = 0;
154
+ });
137
155
  };
138
156
 
139
157
  _proto.handleSortChange = function handleSortChange(finalOrder, sorter, index, cancelOrder, // 是否是自动触发
package/css/index.js CHANGED
@@ -220,6 +220,6 @@ exports.Upload = _Upload.default;
220
220
  // Created by scripts/src-index.js.
221
221
  var _default = {
222
222
  utils: utils,
223
- version: '2.0.4'
223
+ version: '2.0.5-beta.2'
224
224
  };
225
225
  exports.default = _default;