@hipay/hipay-material-ui 1.0.0-beta.23 → 1.0.0-beta.25
Sign up to get free protection for your applications and to get access to all the features.
- package/HI-CHANGELOG.md +26 -43
- package/HiChip/HiChip.js +61 -8
- package/HiDatePicker/HiDateRangePicker.js +27 -13
- package/HiDatePicker/HiDateRangeSelector.js +13 -2
- package/HiForm/HiInput.js +1 -0
- package/HiForm/HiPasswordField.js +2 -2
- package/HiPins/HiPins.js +6 -4
- package/HiSelect/HiSelect.js +7 -5
- package/HiSelect/SelectInput.js +3 -8
- package/HiSelectableList/HiSelectableList.js +51 -49
- package/HiSelectableList/HiSelectableListItem.js +4 -2
- package/HiTable/BodyCellBuilder.js +22 -12
- package/HiTable/BodyCells/CellAccount.js +12 -3
- package/HiTable/BodyCells/CellAccountNumber.js +12 -3
- package/HiTable/BodyCells/CellAddress.js +12 -3
- package/HiTable/BodyCells/CellCountry.js +12 -3
- package/HiTable/BodyCells/CellDate.js +43 -42
- package/HiTable/BodyCells/CellIcon.js +12 -3
- package/HiTable/BodyCells/CellImage.js +12 -3
- package/HiTable/BodyCells/CellNumeric.js +12 -3
- package/HiTable/BodyCells/CellRate.js +12 -3
- package/HiTable/BodyCells/CellSentinel.js +17 -7
- package/HiTable/BodyCells/CellStatus.js +12 -3
- package/HiTable/BodyCells/CellText.js +17 -7
- package/HiTable/BodyCells/CellThirdPartySecurity.js +12 -3
- package/HiTable/BodyRow.js +12 -3
- package/HiTable/ColumnFilter.js +1 -4
- package/HiTable/HeaderCell.js +21 -11
- package/HiTable/HiStickyRow.js +24 -13
- package/HiTable/HiTable.js +30 -69
- package/HiTable/HiTableBody.js +99 -29
- package/HiTable/HiTableContextMenu.js +31 -16
- package/HiTable/HiTableFooter.js +9 -0
- package/HiTable/HiTableHead.js +15 -7
- package/HiTopBar/HiTopBar.js +6 -0
- package/README.md +71 -6
- package/es/HiChip/HiChip.js +74 -8
- package/es/HiDatePicker/HiDateRangePicker.js +25 -12
- package/es/HiDatePicker/HiDateRangeSelector.js +12 -2
- package/es/HiForm/HiInput.js +1 -0
- package/es/HiForm/HiPasswordField.js +2 -2
- package/es/HiPins/HiPins.js +4 -4
- package/es/HiSelect/HiSelect.js +6 -5
- package/es/HiSelect/SelectInput.js +3 -8
- package/es/HiSelectableList/HiSelectableList.js +51 -49
- package/es/HiSelectableList/HiSelectableListItem.js +4 -2
- package/es/HiTable/BodyCellBuilder.js +8 -2
- package/es/HiTable/BodyCells/CellAccount.js +6 -1
- package/es/HiTable/BodyCells/CellAccountNumber.js +6 -1
- package/es/HiTable/BodyCells/CellAddress.js +6 -1
- package/es/HiTable/BodyCells/CellCountry.js +6 -1
- package/es/HiTable/BodyCells/CellDate.js +28 -37
- package/es/HiTable/BodyCells/CellIcon.js +6 -1
- package/es/HiTable/BodyCells/CellImage.js +6 -1
- package/es/HiTable/BodyCells/CellNumeric.js +6 -1
- package/es/HiTable/BodyCells/CellRate.js +6 -1
- package/es/HiTable/BodyCells/CellSentinel.js +6 -1
- package/es/HiTable/BodyCells/CellStatus.js +6 -1
- package/es/HiTable/BodyCells/CellText.js +6 -1
- package/es/HiTable/BodyCells/CellThirdPartySecurity.js +6 -1
- package/es/HiTable/BodyRow.js +7 -2
- package/es/HiTable/ColumnFilter.js +1 -4
- package/es/HiTable/HeaderCell.js +16 -9
- package/es/HiTable/HiStickyRow.js +20 -13
- package/es/HiTable/HiTable.js +4 -40
- package/es/HiTable/HiTableBody.js +78 -26
- package/es/HiTable/HiTableContextMenu.js +28 -16
- package/es/HiTable/HiTableFooter.js +5 -0
- package/es/HiTable/HiTableHead.js +11 -6
- package/es/HiTopBar/HiTopBar.js +5 -0
- package/es/utils/HiIconBuilder.js +6 -2
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +6 -1
- package/umd/hipay-material-ui.development.js +80901 -47149
- package/umd/hipay-material-ui.production.min.js +5 -5
- package/utils/HiIconBuilder.js +6 -2
@@ -13,18 +13,22 @@ var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
|
13
13
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
15
15
|
|
16
|
-
var
|
16
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
17
17
|
|
18
|
-
var
|
18
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
19
19
|
|
20
|
-
var
|
20
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
21
21
|
|
22
|
-
var
|
22
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
23
23
|
|
24
24
|
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
25
25
|
|
26
26
|
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
27
27
|
|
28
|
+
var _createClass2 = require('babel-runtime/helpers/createClass');
|
29
|
+
|
30
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
31
|
+
|
28
32
|
var _inherits2 = require('babel-runtime/helpers/inherits');
|
29
33
|
|
30
34
|
var _inherits3 = _interopRequireDefault(_inherits2);
|
@@ -77,8 +81,14 @@ var styles = exports.styles = function styles(theme) {
|
|
77
81
|
};
|
78
82
|
};
|
79
83
|
|
80
|
-
var CellText = function (_React$
|
81
|
-
(0, _inherits3.default)(CellText, _React$
|
84
|
+
var CellText = function (_React$Component) {
|
85
|
+
(0, _inherits3.default)(CellText, _React$Component);
|
86
|
+
(0, _createClass3.default)(CellText, [{
|
87
|
+
key: 'shouldComponentUpdate',
|
88
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
89
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
90
|
+
}
|
91
|
+
}]);
|
82
92
|
|
83
93
|
function CellText(props) {
|
84
94
|
(0, _classCallCheck3.default)(this, CellText);
|
@@ -249,7 +259,7 @@ var CellText = function (_React$PureComponent) {
|
|
249
259
|
}
|
250
260
|
}]);
|
251
261
|
return CellText;
|
252
|
-
}(_react2.default.
|
262
|
+
}(_react2.default.Component);
|
253
263
|
|
254
264
|
CellText.propTypes = process.env.NODE_ENV !== "production" ? {
|
255
265
|
/**
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.styles = undefined;
|
7
7
|
|
8
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
9
|
+
|
10
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
11
|
+
|
8
12
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
9
13
|
|
10
14
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -58,8 +62,8 @@ var styles = exports.styles = {
|
|
58
62
|
*/
|
59
63
|
// @inheritedComponent CellLayout
|
60
64
|
|
61
|
-
var CellThirdPartySecurity = function (_React$
|
62
|
-
(0, _inherits3.default)(CellThirdPartySecurity, _React$
|
65
|
+
var CellThirdPartySecurity = function (_React$Component) {
|
66
|
+
(0, _inherits3.default)(CellThirdPartySecurity, _React$Component);
|
63
67
|
|
64
68
|
function CellThirdPartySecurity() {
|
65
69
|
(0, _classCallCheck3.default)(this, CellThirdPartySecurity);
|
@@ -67,6 +71,11 @@ var CellThirdPartySecurity = function (_React$PureComponent) {
|
|
67
71
|
}
|
68
72
|
|
69
73
|
(0, _createClass3.default)(CellThirdPartySecurity, [{
|
74
|
+
key: 'shouldComponentUpdate',
|
75
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
76
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
77
|
+
}
|
78
|
+
}, {
|
70
79
|
key: 'render',
|
71
80
|
value: function render() {
|
72
81
|
var _props = this.props,
|
@@ -133,7 +142,7 @@ var CellThirdPartySecurity = function (_React$PureComponent) {
|
|
133
142
|
}
|
134
143
|
}]);
|
135
144
|
return CellThirdPartySecurity;
|
136
|
-
}(_react2.default.
|
145
|
+
}(_react2.default.Component);
|
137
146
|
|
138
147
|
CellThirdPartySecurity.propTypes = process.env.NODE_ENV !== "production" ? {
|
139
148
|
/**
|
package/HiTable/BodyRow.js
CHANGED
@@ -17,6 +17,10 @@ var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProp
|
|
17
17
|
|
18
18
|
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
19
19
|
|
20
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
21
|
+
|
22
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
23
|
+
|
20
24
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
21
25
|
|
22
26
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -104,8 +108,8 @@ var styles = exports.styles = function styles(theme) {
|
|
104
108
|
};
|
105
109
|
};
|
106
110
|
|
107
|
-
var BodyRow = function (_React$
|
108
|
-
(0, _inherits3.default)(BodyRow, _React$
|
111
|
+
var BodyRow = function (_React$Component) {
|
112
|
+
(0, _inherits3.default)(BodyRow, _React$Component);
|
109
113
|
|
110
114
|
function BodyRow(props) {
|
111
115
|
(0, _classCallCheck3.default)(this, BodyRow);
|
@@ -133,6 +137,11 @@ var BodyRow = function (_React$PureComponent) {
|
|
133
137
|
}
|
134
138
|
|
135
139
|
(0, _createClass3.default)(BodyRow, [{
|
140
|
+
key: 'shouldComponentUpdate',
|
141
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
142
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
143
|
+
}
|
144
|
+
}, {
|
136
145
|
key: 'componentDidMount',
|
137
146
|
value: function componentDidMount() {
|
138
147
|
// Live data animation
|
@@ -337,7 +346,7 @@ var BodyRow = function (_React$PureComponent) {
|
|
337
346
|
}
|
338
347
|
}]);
|
339
348
|
return BodyRow;
|
340
|
-
}(_react2.default.
|
349
|
+
}(_react2.default.Component);
|
341
350
|
|
342
351
|
BodyRow.defaultProps = {
|
343
352
|
selectable: false,
|
package/HiTable/ColumnFilter.js
CHANGED
@@ -95,9 +95,6 @@ var styles = exports.styles = function styles(theme) {
|
|
95
95
|
padding: 10,
|
96
96
|
color: theme.palette.neutral.normal
|
97
97
|
},
|
98
|
-
menuItemSortable: {
|
99
|
-
paddingLeft: 8
|
100
|
-
},
|
101
98
|
menuItemFilter: (0, _extends3.default)({}, theme.typography.body1, {
|
102
99
|
color: theme.palette.neutral.dark,
|
103
100
|
fontWeight: theme.typography.fontWeightMedium,
|
@@ -299,7 +296,7 @@ var ColumnFilter = function (_React$Component) {
|
|
299
296
|
),
|
300
297
|
!!sortable && _react2.default.createElement(
|
301
298
|
'div',
|
302
|
-
|
299
|
+
null,
|
303
300
|
_react2.default.createElement(
|
304
301
|
_MenuItem2.default,
|
305
302
|
{
|
package/HiTable/HeaderCell.js
CHANGED
@@ -9,6 +9,10 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
|
9
9
|
|
10
10
|
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
11
11
|
|
12
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
13
|
+
|
14
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
15
|
+
|
12
16
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
13
17
|
|
14
18
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -150,21 +154,22 @@ var styles = exports.styles = function styles(theme) {
|
|
150
154
|
* Construit une cellule d'entête avec le titre, clickable, triable et filtrable
|
151
155
|
*/
|
152
156
|
|
153
|
-
var HeaderCell = function (_React$
|
154
|
-
(0, _inherits3.default)(HeaderCell, _React$
|
157
|
+
var HeaderCell = function (_React$Component) {
|
158
|
+
(0, _inherits3.default)(HeaderCell, _React$Component);
|
155
159
|
|
156
160
|
function HeaderCell(props) {
|
157
161
|
(0, _classCallCheck3.default)(this, HeaderCell);
|
158
162
|
|
159
163
|
var _this = (0, _possibleConstructorReturn3.default)(this, (HeaderCell.__proto__ || (0, _getPrototypeOf2.default)(HeaderCell)).call(this, props));
|
160
164
|
|
165
|
+
_this.anchorEl = null;
|
166
|
+
|
161
167
|
_this.onFilterClick = function (event, columnDataset) {
|
162
168
|
_this.openFilterMenu(event, columnDataset);
|
163
169
|
};
|
164
170
|
|
165
171
|
_this.state = {
|
166
172
|
filterOpen: false,
|
167
|
-
anchorEl: null,
|
168
173
|
menuFilters: []
|
169
174
|
};
|
170
175
|
|
@@ -177,18 +182,24 @@ var HeaderCell = function (_React$PureComponent) {
|
|
177
182
|
}
|
178
183
|
|
179
184
|
(0, _createClass3.default)(HeaderCell, [{
|
185
|
+
key: 'shouldComponentUpdate',
|
186
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
187
|
+
return (0, _stringify2.default)(nextProps) !== (0, _stringify2.default)(this.props) || (0, _stringify2.default)(nextState) !== (0, _stringify2.default)(this.state);
|
188
|
+
}
|
189
|
+
}, {
|
180
190
|
key: 'openFilterMenu',
|
181
191
|
value: function openFilterMenu(event, columnDataset) {
|
182
192
|
this.setState({
|
183
193
|
filterOpen: true,
|
184
|
-
anchorEl: event.currentTarget,
|
185
194
|
menuFilters: columnDataset
|
186
195
|
});
|
196
|
+
this.anchorEl = event.currentTarget;
|
187
197
|
}
|
188
198
|
}, {
|
189
199
|
key: 'handleClose',
|
190
200
|
value: function handleClose() {
|
191
|
-
this.setState({ filterOpen: false,
|
201
|
+
this.setState({ filterOpen: false, menuFilters: [] });
|
202
|
+
this.anchorEl = null;
|
192
203
|
}
|
193
204
|
|
194
205
|
/**
|
@@ -236,7 +247,6 @@ var HeaderCell = function (_React$PureComponent) {
|
|
236
247
|
translations = _props.translations;
|
237
248
|
var _state = this.state,
|
238
249
|
filterOpen = _state.filterOpen,
|
239
|
-
anchorEl = _state.anchorEl,
|
240
250
|
menuFilters = _state.menuFilters;
|
241
251
|
|
242
252
|
|
@@ -318,7 +328,6 @@ var HeaderCell = function (_React$PureComponent) {
|
|
318
328
|
_filterable ? _this2.onFilterClick(event, filterSource) : _this2.handleSort(sortDirection === 'asc' ? 'desc' : 'asc');
|
319
329
|
}
|
320
330
|
},
|
321
|
-
align === 'right' && _icons,
|
322
331
|
_react2.default.createElement(
|
323
332
|
'span',
|
324
333
|
{
|
@@ -326,7 +335,7 @@ var HeaderCell = function (_React$PureComponent) {
|
|
326
335
|
},
|
327
336
|
view !== 's' ? title : smallTitle || title
|
328
337
|
),
|
329
|
-
|
338
|
+
_icons
|
330
339
|
) : _react2.default.createElement(
|
331
340
|
'div',
|
332
341
|
{
|
@@ -353,7 +362,7 @@ var HeaderCell = function (_React$PureComponent) {
|
|
353
362
|
filterValueList: menuFilters,
|
354
363
|
isOpen: filterOpen,
|
355
364
|
onClose: this.handleClose,
|
356
|
-
anchorEl: anchorEl,
|
365
|
+
anchorEl: this.anchorEl,
|
357
366
|
sortable: sortable,
|
358
367
|
onSort: this.handleSort,
|
359
368
|
onFilterChange: this.handleFilterChange,
|
@@ -363,7 +372,7 @@ var HeaderCell = function (_React$PureComponent) {
|
|
363
372
|
}
|
364
373
|
}]);
|
365
374
|
return HeaderCell;
|
366
|
-
}(_react2.default.
|
375
|
+
}(_react2.default.Component);
|
367
376
|
|
368
377
|
HeaderCell.defaultProps = {
|
369
378
|
selectable: false,
|
@@ -375,7 +384,8 @@ HeaderCell.defaultProps = {
|
|
375
384
|
dense: false,
|
376
385
|
fixedColumnWidth: true,
|
377
386
|
sticky: true,
|
378
|
-
padding: 8
|
387
|
+
padding: 8,
|
388
|
+
translations: {}
|
379
389
|
};
|
380
390
|
HeaderCell.propTypes = process.env.NODE_ENV !== "production" ? {
|
381
391
|
/**
|
package/HiTable/HiStickyRow.js
CHANGED
@@ -9,6 +9,10 @@ var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
|
9
9
|
|
10
10
|
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
11
11
|
|
12
|
+
var _stringify = require('babel-runtime/core-js/json/stringify');
|
13
|
+
|
14
|
+
var _stringify2 = _interopRequireDefault(_stringify);
|
15
|
+
|
12
16
|
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
13
17
|
|
14
18
|
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
@@ -138,6 +142,11 @@ var HiStickyRow = function (_React$PureComponent) {
|
|
138
142
|
}
|
139
143
|
|
140
144
|
(0, _createClass3.default)(HiStickyRow, [{
|
145
|
+
key: 'shouldComponentUpdate',
|
146
|
+
value: function shouldComponentUpdate(nextProps, nextState) {
|
147
|
+
return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
|
148
|
+
}
|
149
|
+
}, {
|
141
150
|
key: 'render',
|
142
151
|
value: function render() {
|
143
152
|
var _this2 = this;
|
@@ -189,18 +198,24 @@ var HiStickyRow = function (_React$PureComponent) {
|
|
189
198
|
className: 'stickyRowContent',
|
190
199
|
style: {
|
191
200
|
position: 'relative',
|
192
|
-
top: dense ? 3 : 2
|
201
|
+
top: dense ? 3 : 2,
|
202
|
+
display: 'flex',
|
203
|
+
alignItems: 'center'
|
193
204
|
}
|
194
205
|
},
|
195
206
|
_react2.default.createElement(
|
196
|
-
'
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
_react2.default.createElement(
|
207
|
+
'div',
|
208
|
+
null,
|
209
|
+
_react2.default.createElement(
|
210
|
+
'span',
|
211
|
+
{ id: 'sticky-label', className: classes.label },
|
212
|
+
label
|
213
|
+
),
|
214
|
+
_react2.default.createElement(
|
215
|
+
'span',
|
216
|
+
{ id: 'sticky-badge', style: { position: 'relative' } },
|
217
|
+
_react2.default.createElement(_HiChip2.default, { label: length, classes: { root: classes.badgeRoot } })
|
218
|
+
)
|
204
219
|
),
|
205
220
|
_react2.default.createElement(
|
206
221
|
_Button2.default,
|
@@ -287,10 +302,6 @@ HiStickyRow.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
287
302
|
* Objet contenant les éléments textuels du composant
|
288
303
|
*/
|
289
304
|
translations: _propTypes2.default.object.isRequired,
|
290
|
-
/**
|
291
|
-
* Valeur de la ligne
|
292
|
-
*/
|
293
|
-
value: _propTypes2.default.string,
|
294
305
|
/**
|
295
306
|
* Taille du tableau (L/M/S),
|
296
307
|
* définit l'espace entre les cellules et leurs tailles par default
|
package/HiTable/HiTable.js
CHANGED
@@ -221,27 +221,9 @@ var HiTable = function (_React$Component) {
|
|
221
221
|
|
222
222
|
_this.state = {
|
223
223
|
dateUpdate: Date.now(),
|
224
|
-
isScrollToBottom: false
|
225
|
-
groupByIds: {}
|
224
|
+
isScrollToBottom: false
|
226
225
|
};
|
227
226
|
|
228
|
-
// create associative array (object) with sticky row key & its values
|
229
|
-
// => used for sticky row badges
|
230
|
-
if (props.groupBy) {
|
231
|
-
props.dataSource.map(function (row) {
|
232
|
-
var value = row.datas[props.groupBy].value;
|
233
|
-
var date = new Date(value);
|
234
|
-
|
235
|
-
if (date instanceof Date && isFinite(date)) {
|
236
|
-
value = value.substr(0, 10);
|
237
|
-
}
|
238
|
-
if (!_this.state.groupByIds.hasOwnProperty(value)) {
|
239
|
-
_this.state.groupByIds[value] = [];
|
240
|
-
}
|
241
|
-
_this.state.groupByIds[value].push(row.datas);
|
242
|
-
});
|
243
|
-
}
|
244
|
-
|
245
227
|
// Orderable
|
246
228
|
_this.openOrderColumnsMenu = _this.openOrderColumnsMenu.bind(_this);
|
247
229
|
_this.closeOrderColumnsMenu = _this.closeOrderColumnsMenu.bind(_this);
|
@@ -313,8 +295,6 @@ var HiTable = function (_React$Component) {
|
|
313
295
|
}, {
|
314
296
|
key: 'componentDidUpdate',
|
315
297
|
value: function componentDidUpdate(prevProps, prevState, prevContext) {
|
316
|
-
var _this2 = this;
|
317
|
-
|
318
298
|
this.wrapperScrollOffset = this.wrapperDiv.scrollWidth - this.wrapperDiv.offsetWidth;
|
319
299
|
|
320
300
|
// If orderedColumns has change, possibly the sticky cells has changed too
|
@@ -342,28 +322,10 @@ var HiTable = function (_React$Component) {
|
|
342
322
|
// Only if needed
|
343
323
|
if (this.props.dataSource.length > prevProps.dataSource.length || this.props.dense !== prevProps.dense || this.props.sortedColumnId !== prevProps.sortedColumnId || this.props.sortDirection !== prevProps.sortDirection) {
|
344
324
|
this.updateStickyRowsPosition();
|
345
|
-
if (this.props.dataSource.length
|
325
|
+
if (this.props.dataSource.length !== prevProps.dataSource.length) {
|
346
326
|
this.handleStickyRowPositions();
|
347
327
|
}
|
348
328
|
}
|
349
|
-
if (this.props.dataSource.length > prevProps.dataSource.length && this.props.groupBy) {
|
350
|
-
// create associative array (object) with sticky row key & its values
|
351
|
-
// => used for sticky row badges
|
352
|
-
var groupByIds = {};
|
353
|
-
this.props.dataSource.map(function (row) {
|
354
|
-
var value = row.datas[_this2.props.groupBy].value;
|
355
|
-
var date = new Date(value);
|
356
|
-
|
357
|
-
if (date instanceof Date && isFinite(date)) {
|
358
|
-
value = value.substr(0, 10);
|
359
|
-
}
|
360
|
-
if (!groupByIds.hasOwnProperty(value)) {
|
361
|
-
groupByIds[value] = [];
|
362
|
-
}
|
363
|
-
groupByIds[value].push(row.datas);
|
364
|
-
});
|
365
|
-
this.setState({ groupByIds: groupByIds });
|
366
|
-
}
|
367
329
|
|
368
330
|
this.isScrollToBottom(this.scrollTop === this.tBody.scrollHeight - this.tBody.offsetHeight);
|
369
331
|
|
@@ -375,7 +337,7 @@ var HiTable = function (_React$Component) {
|
|
375
337
|
}, {
|
376
338
|
key: 'updateStickyRowsPosition',
|
377
339
|
value: function updateStickyRowsPosition() {
|
378
|
-
var
|
340
|
+
var _this2 = this;
|
379
341
|
|
380
342
|
var rowHeight = this.props.dense ? cst.CELL_HEIGHT_DENSE : cst.CELL_HEIGHT;
|
381
343
|
this.groupByRowsPositions = [];
|
@@ -384,7 +346,7 @@ var HiTable = function (_React$Component) {
|
|
384
346
|
var stickyRows = tableBody.getElementsByClassName('stickyGroupBy');
|
385
347
|
if (stickyRows.length > 0) {
|
386
348
|
Array.prototype.filter.call(stickyRows, function (stickyRow) {
|
387
|
-
|
349
|
+
_this2.groupByRowsPositions.push(stickyRow.nextSibling.nextSibling.offsetTop - rowHeight);
|
388
350
|
});
|
389
351
|
}
|
390
352
|
}
|
@@ -509,7 +471,7 @@ var HiTable = function (_React$Component) {
|
|
509
471
|
}, {
|
510
472
|
key: 'handleStickyRowPositions',
|
511
473
|
value: function handleStickyRowPositions() {
|
512
|
-
var
|
474
|
+
var _this3 = this;
|
513
475
|
|
514
476
|
var tableBody = document.getElementById(this.props.tabId + '-body');
|
515
477
|
var stickyRows = tableBody.getElementsByClassName('stickyGroupBy');
|
@@ -517,14 +479,14 @@ var HiTable = function (_React$Component) {
|
|
517
479
|
if (stickyRows.length > 0) {
|
518
480
|
Array.prototype.filter.call(stickyRows, function (stickyRow, index) {
|
519
481
|
var fakeTr = stickyRow.nextSibling;
|
520
|
-
if (tableBody.scrollTop >
|
482
|
+
if (tableBody.scrollTop > _this3.groupByRowsPositions[index]) {
|
521
483
|
// Calcul de la position du 'pinned' item
|
522
484
|
// positionnement juste en dessous du header
|
523
485
|
if (typeof stickyRows[index + 1] === 'undefined' || tableBody.scrollTop < stickyRows[index + 1].offsetTop) {
|
524
486
|
// Si la prochaine ligne est aussi un 'pinned' item,
|
525
487
|
// il pousse le précédent vers le haut
|
526
|
-
if (typeof
|
527
|
-
stickyRow.style.top = tableBody.scrollTop +
|
488
|
+
if (typeof _this3.groupByRowsPositions[index + 1] !== 'undefined' && _this3.groupByRowsPositions[index + 1] - tableBody.scrollTop < rowHeight - 10) {
|
489
|
+
stickyRow.style.top = tableBody.scrollTop + _this3.groupByRowsPositions[index + 1] - tableBody.scrollTop - rowHeight + '\n px';
|
528
490
|
} else {
|
529
491
|
stickyRow.style.top = tableBody.scrollTop + 'px';
|
530
492
|
}
|
@@ -533,13 +495,13 @@ var HiTable = function (_React$Component) {
|
|
533
495
|
// Repositionnement des éléments dans une row en position absolute
|
534
496
|
stickyRow.style.position = 'absolute';
|
535
497
|
fakeTr.style.display = 'inline-block';
|
536
|
-
stickyRow.style.height =
|
537
|
-
stickyRow.querySelector('button').style.maxHeight =
|
538
|
-
stickyRow.querySelector('button').style.minHeight =
|
498
|
+
stickyRow.style.height = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 8 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
|
499
|
+
stickyRow.querySelector('button').style.maxHeight = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 16 + 'px' : cst.CELL_HEIGHT - 16 + 'px';
|
500
|
+
stickyRow.querySelector('button').style.minHeight = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 16 + 'px' : cst.CELL_HEIGHT - 16 + 'px';
|
539
501
|
stickyRow.querySelector('button').style.top = '-3px';
|
540
|
-
stickyRow.querySelector('#stickyRowContent').style.top = !
|
541
|
-
stickyRow.querySelector('td').style.height =
|
542
|
-
if (
|
502
|
+
stickyRow.querySelector('#stickyRowContent').style.top = !_this3.props.dense ? '4px' : '-3px';
|
503
|
+
stickyRow.querySelector('td').style.height = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 8 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
|
504
|
+
if (_this3.props.dense) {
|
543
505
|
stickyRow.querySelector('button').style.top = '0px';
|
544
506
|
stickyRow.querySelector('button span').style.position = 'relative';
|
545
507
|
stickyRow.querySelector('button span').style.top = '-4px';
|
@@ -551,13 +513,13 @@ var HiTable = function (_React$Component) {
|
|
551
513
|
stickyRow.style.position = 'relative';
|
552
514
|
stickyRow.style.top = '0px';
|
553
515
|
fakeTr.style.display = 'none';
|
554
|
-
stickyRow.style.height =
|
516
|
+
stickyRow.style.height = _this3.props.dense ? cst.CELL_HEIGHT_DENSE + 'px' : cst.CELL_HEIGHT + 'px';
|
555
517
|
stickyRow.querySelector('#sticky-badge').style.top = '0px';
|
556
518
|
stickyRow.querySelector('#stickyRowContent').style.top = '2px';
|
557
|
-
stickyRow.querySelector('td').style.height =
|
558
|
-
stickyRow.querySelector('button').style.maxHeight =
|
559
|
-
stickyRow.querySelector('button').style.minHeight =
|
560
|
-
if (
|
519
|
+
stickyRow.querySelector('td').style.height = _this3.props.dense ? cst.CELL_HEIGHT_DENSE + 'px' : cst.CELL_HEIGHT + 'px';
|
520
|
+
stickyRow.querySelector('button').style.maxHeight = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 2 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
|
521
|
+
stickyRow.querySelector('button').style.minHeight = _this3.props.dense ? cst.CELL_HEIGHT_DENSE - 2 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
|
522
|
+
if (_this3.props.dense) {
|
561
523
|
stickyRow.querySelector('button span').style.top = '0px';
|
562
524
|
}
|
563
525
|
}
|
@@ -572,7 +534,7 @@ var HiTable = function (_React$Component) {
|
|
572
534
|
}, {
|
573
535
|
key: 'placeHorizontalFloatingElement',
|
574
536
|
value: function placeHorizontalFloatingElement() {
|
575
|
-
var
|
537
|
+
var _this4 = this;
|
576
538
|
|
577
539
|
// live datas notification
|
578
540
|
if (this.liveDataSpan) {
|
@@ -581,7 +543,7 @@ var HiTable = function (_React$Component) {
|
|
581
543
|
|
582
544
|
// Replace left padding cells
|
583
545
|
[].concat((0, _toConsumableArray3.default)(this.tBodyLeftPaddingElements), [this.tHeadLeftPadding]).forEach(function (element) {
|
584
|
-
element.style.left =
|
546
|
+
element.style.left = _this4.scrollLeft + 'px';
|
585
547
|
});
|
586
548
|
|
587
549
|
// TODO - FIX
|
@@ -590,15 +552,15 @@ var HiTable = function (_React$Component) {
|
|
590
552
|
|
591
553
|
// Replace right padding cells
|
592
554
|
[].concat((0, _toConsumableArray3.default)(this.tBodyRightPaddingElements), [this.tHeadRightPadding]).forEach(function (element) {
|
593
|
-
element.style.right = Math.max(0,
|
555
|
+
element.style.right = Math.max(0, _this4.wrapperScrollOffset - _this4.scrollLeft - _this4.tBodyScrollbarWidth) + 'px';
|
594
556
|
});
|
595
557
|
|
596
558
|
// Replace first cells & add right shadows
|
597
559
|
if (this.props.sticky) {
|
598
560
|
var shadowRight = '1px 0px 0px 0px rgba(128, 128, 128, 0.32)';
|
599
561
|
[].concat((0, _toConsumableArray3.default)(this.tBodyFirstElements), [this.tHeadFirst]).forEach(function (element) {
|
600
|
-
element.style.left =
|
601
|
-
element.style['box-shadow'] =
|
562
|
+
element.style.left = _this4.scrollLeft + 'px';
|
563
|
+
element.style['box-shadow'] = _this4.scrollLeft > 0 ? shadowRight : 'none';
|
602
564
|
});
|
603
565
|
}
|
604
566
|
|
@@ -612,7 +574,7 @@ var HiTable = function (_React$Component) {
|
|
612
574
|
var stickyRowContentDiv = tableBody.getElementsByClassName('stickyRowContent');
|
613
575
|
if (stickyRowContentDiv.length > 0) {
|
614
576
|
Array.prototype.filter.call(stickyRowContentDiv, function (div) {
|
615
|
-
div.style.left =
|
577
|
+
div.style.left = _this4.wrapperDiv.scrollLeft + (_this4.props.selectable ? 25 : 0) + 'px';
|
616
578
|
});
|
617
579
|
}
|
618
580
|
}
|
@@ -677,7 +639,7 @@ var HiTable = function (_React$Component) {
|
|
677
639
|
}, {
|
678
640
|
key: 'render',
|
679
641
|
value: function render() {
|
680
|
-
var
|
642
|
+
var _this5 = this;
|
681
643
|
|
682
644
|
var _props = this.props,
|
683
645
|
classes = _props.classes,
|
@@ -717,8 +679,7 @@ var HiTable = function (_React$Component) {
|
|
717
679
|
detailRowsOptions = _props.detailRowsOptions;
|
718
680
|
var _state = this.state,
|
719
681
|
dateUpdate = _state.dateUpdate,
|
720
|
-
isScrollToBottom = _state.isScrollToBottom
|
721
|
-
groupByIds = _state.groupByIds;
|
682
|
+
isScrollToBottom = _state.isScrollToBottom;
|
722
683
|
|
723
684
|
|
724
685
|
var headerHeight = dense ? cst.CELL_HEADER_HEIGHT_DENSE : cst.CELL_HEADER_HEIGHT;
|
@@ -739,7 +700,7 @@ var HiTable = function (_React$Component) {
|
|
739
700
|
id: tabId,
|
740
701
|
className: classes.tableWrapper,
|
741
702
|
ref: function ref(div) {
|
742
|
-
return
|
703
|
+
return _this5.wrapperDiv = div;
|
743
704
|
},
|
744
705
|
onScroll: this.handleHorizontalScroll
|
745
706
|
},
|
@@ -796,7 +757,6 @@ var HiTable = function (_React$Component) {
|
|
796
757
|
translations: translations.tableBody,
|
797
758
|
groupBy: groupBy,
|
798
759
|
onClickNext: this.handleNextStickyRow,
|
799
|
-
groupByIds: groupByIds,
|
800
760
|
lookupColumns: lookupColumns,
|
801
761
|
loading: loading,
|
802
762
|
fixedColumnWidth: fixedColumnWidth,
|
@@ -822,6 +782,7 @@ var HiTable = function (_React$Component) {
|
|
822
782
|
),
|
823
783
|
_react2.default.createElement(_HiTableContextMenu2.default, {
|
824
784
|
tabId: tabId,
|
785
|
+
columns: columns,
|
825
786
|
onSearch: this.props.onSearch,
|
826
787
|
onRedirect: this.props.onRedirect
|
827
788
|
}),
|
@@ -835,7 +796,7 @@ var HiTable = function (_React$Component) {
|
|
835
796
|
color: 'primary',
|
836
797
|
className: classes.backToTopButton,
|
837
798
|
onClick: function onClick() {
|
838
|
-
return
|
799
|
+
return _this5.scrollToTop();
|
839
800
|
}
|
840
801
|
},
|
841
802
|
_react2.default.createElement(_ArrowUp2.default, { className: classes.backToTopButtonArrow }),
|