Skip to content

Commit 1105f28

Browse files
author
Tina C Lin (RD-TW)
committed
v0.4.2
1 parent e1d620c commit 1105f28

File tree

6 files changed

+22
-26
lines changed

6 files changed

+22
-26
lines changed

dist/react-table.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-table.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/bundle.js

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47146,7 +47146,7 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4714647146
args[_key] = arguments[_key];
4714747147
}
4714847148

47149-
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Table.__proto__ || Object.getPrototypeOf(Table)).call.apply(_ref, [this].concat(args))), _this), _this.mainTable = null, _this.thisColumns = _this.columnsParser(), _this.state = _this.getInitState(), _this.actions = {
47149+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Table.__proto__ || Object.getPrototypeOf(Table)).call.apply(_ref, [this].concat(args))), _this), _this.mainTable = null, _this.state = _this.getInitState(), _this.actions = {
4715047150
detectScrollTarget: function detectScrollTarget(e) {
4715147151
if (_this.scrollTarget !== e.currentTarget) {
4715247152
_this.scrollTarget = e.currentTarget;
@@ -47183,13 +47183,6 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4718347183
}
4718447184

4718547185
_createClass(Table, [{
47186-
key: 'componentWillReceiveProps',
47187-
value: function componentWillReceiveProps(nextProps) {
47188-
if (nextProps.columns !== this.props.columns) {
47189-
this.thisColumns = this.columnsParser();
47190-
}
47191-
}
47192-
}, {
4719347186
key: 'componentDidMount',
4719447187
value: function componentDidMount() {
4719547188
var getTableHeight = this.actions.getTableHeight;
@@ -47207,6 +47200,11 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4720747200
}, {
4720847201
key: 'componentDidUpdate',
4720947202
value: function componentDidUpdate(prevProps, prevState) {
47203+
if (prevProps.columns !== this.props.columns) {
47204+
this.setState({
47205+
thisColumns: this.columnsParser()
47206+
});
47207+
}
4721047208
if (prevProps.data !== this.props.data || prevProps.maxHeight !== this.props.maxHeight) {
4721147209
var getTableHeight = this.actions.getTableHeight;
4721247210

@@ -47219,7 +47217,8 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4721947217
return {
4722047218
currentHoverKey: null,
4722147219
scrollTop: 0,
47222-
tableHeight: 0
47220+
tableHeight: 0,
47221+
thisColumns: this.columnsParser()
4722347222
};
4722447223
}
4722547224
}, {
@@ -47232,7 +47231,7 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4723247231
}, {
4723347232
key: 'leftColumns',
4723447233
value: function leftColumns() {
47235-
var columns = this.thisColumns;
47234+
var columns = this.state.thisColumns;
4723647235
var fixedColumns = columns.filter(function (column) {
4723747236
return column.fixed === true;
4723847237
});
@@ -47245,7 +47244,7 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4724547244
}, {
4724647245
key: 'isAnyColumnsLeftFixed',
4724747246
value: function isAnyColumnsLeftFixed() {
47248-
var columns = this.thisColumns;
47247+
var columns = this.state.thisColumns;
4724947248
return columns.some(function (column) {
4725047249
return column.fixed === true;
4725147250
});
@@ -47255,7 +47254,7 @@ var Table = (_temp2 = _class = function (_PureComponent) {
4725547254
value: function renderTable() {
4725647255
var _this2 = this;
4725747256

47258-
var columns = this.thisColumns;
47257+
var columns = this.state.thisColumns;
4725947258
var _state = this.state,
4726047259
currentHoverKey = _state.currentHoverKey,
4726147260
scrollTop = _state.scrollTop,
@@ -48102,7 +48101,8 @@ var TableTemplate = (_temp2 = _class = function (_PureComponent) {
4810248101
var _this$props = _this.props,
4810348102
averageColumnsWidth = _this$props.averageColumnsWidth,
4810448103
columns = _this$props.columns,
48105-
loading = _this$props.loading;
48104+
loading = _this$props.loading,
48105+
data = _this$props.data;
4810648106

4810748107
var thsWidth = [];
4810848108
if (_this.tableHeader) {
@@ -48135,7 +48135,7 @@ var TableTemplate = (_temp2 = _class = function (_PureComponent) {
4813548135
});
4813648136
}
4813748137

48138-
if (averageColumnsWidth || loading) {
48138+
if (averageColumnsWidth || loading || data.length === 0) {
4813948139
cellWidth = (totalWidth - customWidth.width) / (columns.length - customColumns.length);
4814048140
}
4814148141

@@ -48164,13 +48164,9 @@ var TableTemplate = (_temp2 = _class = function (_PureComponent) {
4816448164
}
4816548165
}
4816648166
} else {
48167+
// No data
4816748168
for (var _j2 = 0; _j2 < columns.length; _j2++) {
48168-
var _customColumn = columns[_j2];
48169-
if (_customColumn && _customColumn.width) {
48170-
cellsWidth[_j2] = _customColumn.width;
48171-
} else {
48172-
cellsWidth[_j2] = cellWidth;
48173-
}
48169+
cellsWidth[_j2] = cellWidth;
4817448170
cellTotalWidth += cellsWidth[_j2];
4817548171
}
4817648172
}
@@ -50033,4 +50029,4 @@ exports.default = _default;
5003350029
/***/ })
5003450030

5003550031
/******/ });
50036-
//# sourceMappingURL=bundle.js.map?aa35608c864f5095ad93
50032+
//# sourceMappingURL=bundle.js.map?2835598b4c46495f2f9e

docs/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
</head>
1212
<body>
1313
<div id="container"></div>
14-
<script type="text/javascript" src="bundle.js?aa35608c864f5095ad93"></script></body>
14+
<script type="text/javascript" src="bundle.js?2835598b4c46495f2f9e"></script></body>
1515
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@trendmicro/react-table",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Trend Micro Components: React Table",
55
"main": "lib/index.js",
66
"files": [

0 commit comments

Comments
 (0)