@hipay/hipay-material-ui 1.0.0-beta.23 → 1.0.0-beta.26

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.
Files changed (83) hide show
  1. package/HI-CHANGELOG.md +58 -39
  2. package/HiChip/HiChip.js +67 -8
  3. package/HiDatePicker/HiDateRangePicker.js +27 -13
  4. package/HiDatePicker/HiDateRangeSelector.js +13 -2
  5. package/HiForm/HiInput.js +1 -0
  6. package/HiForm/HiPasswordField.js +2 -2
  7. package/HiPins/HiPins.js +6 -4
  8. package/HiSelect/HiSelect.js +28 -20
  9. package/HiSelect/SelectInput.js +3 -8
  10. package/HiSelectableList/HiSelectableList.js +51 -49
  11. package/HiSelectableList/HiSelectableListItem.js +7 -5
  12. package/HiTable/BodyCellBuilder.js +25 -14
  13. package/HiTable/BodyCells/CellAccount.js +13 -15
  14. package/HiTable/BodyCells/CellAccountNumber.js +12 -3
  15. package/HiTable/BodyCells/CellAddress.js +12 -3
  16. package/HiTable/BodyCells/CellCountry.js +12 -3
  17. package/HiTable/BodyCells/CellDate.js +56 -52
  18. package/HiTable/BodyCells/CellIcon.js +12 -3
  19. package/HiTable/BodyCells/CellImage.js +12 -3
  20. package/HiTable/BodyCells/CellNumeric.js +12 -3
  21. package/HiTable/BodyCells/CellRate.js +12 -3
  22. package/HiTable/BodyCells/CellSentinel.js +17 -7
  23. package/HiTable/BodyCells/CellStatus.js +12 -3
  24. package/HiTable/BodyCells/CellText.js +75 -37
  25. package/HiTable/BodyCells/CellThirdPartySecurity.js +12 -3
  26. package/HiTable/BodyRow.js +12 -3
  27. package/HiTable/ColumnFilter.js +1 -4
  28. package/HiTable/HeaderCell.js +21 -11
  29. package/HiTable/HiStickyRow.js +27 -16
  30. package/HiTable/HiTable.js +30 -69
  31. package/HiTable/HiTableBody.js +99 -29
  32. package/HiTable/HiTableContextMenu.js +31 -16
  33. package/HiTable/HiTableFooter.js +9 -0
  34. package/HiTable/HiTableHead.js +15 -7
  35. package/HiTopBar/HiTopBar.js +6 -0
  36. package/README.md +72 -6
  37. package/es/HiChip/HiChip.js +81 -9
  38. package/es/HiDatePicker/HiDateRangePicker.js +25 -12
  39. package/es/HiDatePicker/HiDateRangeSelector.js +12 -2
  40. package/es/HiForm/HiInput.js +1 -0
  41. package/es/HiForm/HiPasswordField.js +2 -2
  42. package/es/HiPins/HiPins.js +4 -4
  43. package/es/HiSelect/HiSelect.js +25 -16
  44. package/es/HiSelect/SelectInput.js +3 -8
  45. package/es/HiSelectableList/HiSelectableList.js +51 -49
  46. package/es/HiSelectableList/HiSelectableListItem.js +7 -5
  47. package/es/HiTable/BodyCellBuilder.js +11 -4
  48. package/es/HiTable/BodyCells/CellAccount.js +7 -5
  49. package/es/HiTable/BodyCells/CellAccountNumber.js +6 -1
  50. package/es/HiTable/BodyCells/CellAddress.js +6 -1
  51. package/es/HiTable/BodyCells/CellCountry.js +6 -1
  52. package/es/HiTable/BodyCells/CellDate.js +35 -40
  53. package/es/HiTable/BodyCells/CellIcon.js +6 -1
  54. package/es/HiTable/BodyCells/CellImage.js +6 -1
  55. package/es/HiTable/BodyCells/CellNumeric.js +6 -1
  56. package/es/HiTable/BodyCells/CellRate.js +6 -1
  57. package/es/HiTable/BodyCells/CellSentinel.js +6 -1
  58. package/es/HiTable/BodyCells/CellStatus.js +6 -1
  59. package/es/HiTable/BodyCells/CellText.js +50 -20
  60. package/es/HiTable/BodyCells/CellThirdPartySecurity.js +6 -1
  61. package/es/HiTable/BodyRow.js +7 -2
  62. package/es/HiTable/ColumnFilter.js +1 -4
  63. package/es/HiTable/HeaderCell.js +16 -9
  64. package/es/HiTable/HiStickyRow.js +21 -14
  65. package/es/HiTable/HiTable.js +4 -40
  66. package/es/HiTable/HiTableBody.js +78 -26
  67. package/es/HiTable/HiTableContextMenu.js +28 -16
  68. package/es/HiTable/HiTableFooter.js +5 -0
  69. package/es/HiTable/HiTableHead.js +11 -6
  70. package/es/HiTopBar/HiTopBar.js +5 -0
  71. package/es/svg-icons/Cancel.js +2 -0
  72. package/es/svg-icons/HiBriefcaseRescue.js +15 -0
  73. package/es/svg-icons/index.js +2 -1
  74. package/es/utils/HiIconBuilder.js +6 -2
  75. package/index.es.js +1 -1
  76. package/index.js +1 -1
  77. package/package.json +7 -1
  78. package/svg-icons/Cancel.js +2 -0
  79. package/svg-icons/HiBriefcaseRescue.js +30 -0
  80. package/svg-icons/index.js +9 -0
  81. package/umd/hipay-material-ui.development.js +110915 -119592
  82. package/umd/hipay-material-ui.production.min.js +5 -5
  83. package/utils/HiIconBuilder.js +6 -2
@@ -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);
@@ -129,8 +133,8 @@ var styles = exports.styles = function styles(theme) {
129
133
 
130
134
  var ONCHANGE_ERROR_MESSAGE = exports.ONCHANGE_ERROR_MESSAGE = 'Vous devez saisir la propriété "onChange" pour les lignes "selectable"';
131
135
 
132
- var HiStickyRow = function (_React$PureComponent) {
133
- (0, _inherits3.default)(HiStickyRow, _React$PureComponent);
136
+ var HiStickyRow = function (_React$Component) {
137
+ (0, _inherits3.default)(HiStickyRow, _React$Component);
134
138
 
135
139
  function HiStickyRow() {
136
140
  (0, _classCallCheck3.default)(this, HiStickyRow);
@@ -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
- 'span',
197
- { id: 'sticky-label', className: classes.label },
198
- label
199
- ),
200
- _react2.default.createElement(
201
- 'span',
202
- { id: 'sticky-badge', style: { position: 'relative' } },
203
- _react2.default.createElement(_HiChip2.default, { label: length, classes: { root: classes.badgeRoot } })
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,
@@ -226,7 +241,7 @@ var HiStickyRow = function (_React$PureComponent) {
226
241
  }
227
242
  }]);
228
243
  return HiStickyRow;
229
- }(_react2.default.PureComponent);
244
+ }(_react2.default.Component);
230
245
 
231
246
  HiStickyRow.defaultProps = {
232
247
  dense: false,
@@ -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
@@ -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 > prevProps.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 _this3 = this;
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
- _this3.groupByRowsPositions.push(stickyRow.nextSibling.nextSibling.offsetTop - rowHeight);
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 _this4 = this;
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 > _this4.groupByRowsPositions[index]) {
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 _this4.groupByRowsPositions[index + 1] !== 'undefined' && _this4.groupByRowsPositions[index + 1] - tableBody.scrollTop < rowHeight - 10) {
527
- stickyRow.style.top = tableBody.scrollTop + _this4.groupByRowsPositions[index + 1] - tableBody.scrollTop - rowHeight + '\n px';
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 = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 8 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
537
- stickyRow.querySelector('button').style.maxHeight = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 16 + 'px' : cst.CELL_HEIGHT - 16 + 'px';
538
- stickyRow.querySelector('button').style.minHeight = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 16 + 'px' : cst.CELL_HEIGHT - 16 + 'px';
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 = !_this4.props.dense ? '4px' : '-3px';
541
- stickyRow.querySelector('td').style.height = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 8 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
542
- if (_this4.props.dense) {
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 = _this4.props.dense ? cst.CELL_HEIGHT_DENSE + 'px' : cst.CELL_HEIGHT + 'px';
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 = _this4.props.dense ? cst.CELL_HEIGHT_DENSE + 'px' : cst.CELL_HEIGHT + 'px';
558
- stickyRow.querySelector('button').style.maxHeight = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 2 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
559
- stickyRow.querySelector('button').style.minHeight = _this4.props.dense ? cst.CELL_HEIGHT_DENSE - 2 + 'px' : cst.CELL_HEIGHT - 8 + 'px';
560
- if (_this4.props.dense) {
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 _this5 = this;
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 = _this5.scrollLeft + 'px';
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, _this5.wrapperScrollOffset - _this5.scrollLeft - _this5.tBodyScrollbarWidth) + 'px';
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 = _this5.scrollLeft + 'px';
601
- element.style['box-shadow'] = _this5.scrollLeft > 0 ? shadowRight : 'none';
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 = _this5.wrapperDiv.scrollLeft + (_this5.props.selectable ? 25 : 0) + 'px';
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 _this6 = this;
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 _this6.wrapperDiv = div;
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 _this6.scrollToTop();
799
+ return _this5.scrollToTop();
839
800
  }
840
801
  },
841
802
  _react2.default.createElement(_ArrowUp2.default, { className: classes.backToTopButtonArrow }),
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.styles = undefined;
7
7
 
8
+ var _values = require('babel-runtime/core-js/object/values');
9
+
10
+ var _values2 = _interopRequireDefault(_values);
11
+
12
+ var _stringify = require('babel-runtime/core-js/json/stringify');
13
+
14
+ var _stringify2 = _interopRequireDefault(_stringify);
15
+
8
16
  var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
9
17
 
10
18
  var _defineProperty3 = _interopRequireDefault(_defineProperty2);
@@ -51,6 +59,12 @@ var _classnames = require('classnames');
51
59
 
52
60
  var _classnames2 = _interopRequireDefault(_classnames);
53
61
 
62
+ var _moment = require('moment');
63
+
64
+ var _moment2 = _interopRequireDefault(_moment);
65
+
66
+ require('moment/locale/fr');
67
+
54
68
  var _styles = require('../styles');
55
69
 
56
70
  var _BodyRow = require('./BodyRow');
@@ -69,6 +83,10 @@ var _constants = require('./constants');
69
83
 
70
84
  var cst = _interopRequireWildcard(_constants);
71
85
 
86
+ var _lodash = require('lodash');
87
+
88
+ var _ = _interopRequireWildcard(_lodash);
89
+
72
90
  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)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
73
91
 
74
92
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -132,7 +150,7 @@ var HiTableBody = function (_React$Component) {
132
150
  function HiTableBody(props) {
133
151
  (0, _classCallCheck3.default)(this, HiTableBody);
134
152
 
135
- var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableBody.__proto__ || (0, _getPrototypeOf2.default)(HiTableBody)).call(this));
153
+ var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableBody.__proto__ || (0, _getPrototypeOf2.default)(HiTableBody)).call(this, props));
136
154
 
137
155
  _this.buildIndicator = function (row) {
138
156
  var _this$props = _this.props,
@@ -165,17 +183,52 @@ var HiTableBody = function (_React$Component) {
165
183
 
166
184
  _this.state = {
167
185
  openedParentRowId: null,
168
- openedDetailsRowIdList: []
186
+ openedDetailsRowIdList: [],
187
+ dataSource: props.dataSource,
188
+ groupByIds: {}
169
189
  };
170
190
 
191
+ if (props.groupBy && props.dataSource) {
192
+ var groupByIds = {};
193
+ props.dataSource.map(function (row) {
194
+ var value = row.datas[props.groupBy].value;
195
+ if (!groupByIds.hasOwnProperty(value)) {
196
+ groupByIds[value] = [];
197
+ }
198
+ groupByIds[value].push(row.datas);
199
+ });
200
+ _this.state.groupByIds = groupByIds;
201
+ }
202
+
171
203
  _this.buildIndicator = _this.buildIndicator.bind(_this);
172
204
  _this.setOpenedParentRowId = _this.setOpenedParentRowId.bind(_this);
173
205
  _this.toggleOpenedDetailsRowId = _this.toggleOpenedDetailsRowId.bind(_this);
174
206
  _this.positionStickyRowNextButton = _this.positionStickyRowNextButton.bind(_this);
207
+
208
+ //Monkeypatch TableRow
209
+ /*var that = this;
210
+ TableRow.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState){
211
+ return (this.state.hovered !== nextState.hovered || this.props.selected !== nextProps.selected) && true;
212
+ }*/
175
213
  return _this;
176
214
  }
177
215
 
178
216
  (0, _createClass3.default)(HiTableBody, [{
217
+ key: 'deepCompare',
218
+ value: function deepCompare(object, base) {
219
+ var that = this;
220
+ return _.transform(object, function (result, value, key) {
221
+ if (!_.isEqual(value, base[key])) {
222
+ result[key] = _.isObject(value) && _.isObject(base[key]) ? that.deepCompare(value, base[key]) : value;
223
+ }
224
+ }).length > 0;
225
+ }
226
+
227
+ /*shouldComponentUpdate(nextProps, nextState){
228
+ this.deepCompare(this.props,nextProps) || this.deepCompare(this.state,nextState);
229
+ }*/
230
+
231
+ }, {
179
232
  key: 'componentDidMount',
180
233
  value: function componentDidMount() {
181
234
  this.positionStickyRowNextButton();
@@ -185,6 +238,9 @@ var HiTableBody = function (_React$Component) {
185
238
  value: function componentDidUpdate(prevProps, prevState, prevContext) {
186
239
  this.positionStickyRowNextButton();
187
240
  }
241
+ }, {
242
+ key: 'setOpenedParentRowId',
243
+
188
244
 
189
245
  /**
190
246
  * Définit l'id de la ligne parente "ouverte" ou null
@@ -193,9 +249,6 @@ var HiTableBody = function (_React$Component) {
193
249
  *
194
250
  * @param row
195
251
  */
196
-
197
- }, {
198
- key: 'setOpenedParentRowId',
199
252
  value: function setOpenedParentRowId(row) {
200
253
  this.setState(function (prevState) {
201
254
  return {
@@ -225,7 +278,7 @@ var HiTableBody = function (_React$Component) {
225
278
  }
226
279
  button.parentElement.style.top = '4px';
227
280
  }
228
- var label = button.previousSibling.previousSibling;
281
+ var label = button.previousSibling;
229
282
  button.style.left = tableContainer.offsetWidth - label.offsetWidth - 48 - 160 + 'px';
230
283
  }
231
284
  });
@@ -272,7 +325,6 @@ var HiTableBody = function (_React$Component) {
272
325
  tabId = _props.tabId,
273
326
  columns = _props.columns,
274
327
  orderedColumns = _props.orderedColumns,
275
- dataSource = _props.dataSource,
276
328
  onRowClick = _props.onRowClick,
277
329
  selectable = _props.selectable,
278
330
  onSelect = _props.onSelect,
@@ -287,7 +339,6 @@ var HiTableBody = function (_React$Component) {
287
339
  translations = _props.translations,
288
340
  dateLocale = _props.dateLocale,
289
341
  numberLocale = _props.numberLocale,
290
- groupByIds = _props.groupByIds,
291
342
  sortedColumnId = _props.sortedColumnId,
292
343
  lookupColumns = _props.lookupColumns,
293
344
  loading = _props.loading,
@@ -296,7 +347,9 @@ var HiTableBody = function (_React$Component) {
296
347
  detailRowsOptions = _props.detailRowsOptions;
297
348
  var _state = this.state,
298
349
  openedParentRowId = _state.openedParentRowId,
299
- openedDetailsRowIdList = _state.openedDetailsRowIdList;
350
+ openedDetailsRowIdList = _state.openedDetailsRowIdList,
351
+ groupByIds = _state.groupByIds,
352
+ dataSource = _state.dataSource;
300
353
 
301
354
 
302
355
  var nbColumnsDisplayed = 0;
@@ -315,31 +368,21 @@ var HiTableBody = function (_React$Component) {
315
368
  // Gestion du sticky group by
316
369
  if (typeof groupBy !== 'undefined' && groupBy === sortedColumnId) {
317
370
  var currentGroupByValue = row.datas[groupBy].value;
318
- var date = new Date(currentGroupByValue);
319
- if (date instanceof Date && isFinite(date)) {
320
- currentGroupByValue = currentGroupByValue.substr(0, 10);
321
- }
371
+
322
372
  // TODO => condition for other columns type
323
373
  if (columns[groupBy].type === cst.TYPE_DATE) {
324
- if (index === 0 || currentGroupByValue !== stickyRowValue) {
325
- stickyRowValue = currentGroupByValue;
326
- var label = stickyRowValue;
327
- if (date instanceof Date && isFinite(date)) {
328
- label = new Date(label);
329
- var options = {
330
- year: 'numeric',
331
- month: 'long',
332
- weekday: 'long',
333
- day: 'numeric'
334
- };
335
- label = label.toLocaleString(dateLocale, options);
336
- label = label.charAt(0).toUpperCase() + label.substr(1);
337
- }
374
+
375
+ _moment2.default.locale(dateLocale);
376
+ var date = (0, _moment2.default)(currentGroupByValue);
377
+ var label = date.format('dddd D MMMM YYYY');
378
+
379
+ if (index === 0 || label !== stickyRowValue) {
380
+
381
+ stickyRowValue = label;
338
382
 
339
383
  tableRows.push(_react2.default.createElement(_HiStickyRow2.default, {
340
384
  key: 'sticky_row_' + row.rowId,
341
385
  dense: dense,
342
- value: stickyRowValue,
343
386
  label: label,
344
387
  length: groupByIds[currentGroupByValue].length,
345
388
  colSpan: nbColumnsDisplayed,
@@ -424,7 +467,9 @@ var HiTableBody = function (_React$Component) {
424
467
  sticky: sticky,
425
468
  isDetail: true,
426
469
  fixedColumnWidth: fixedColumnWidth,
427
- disableContextMenu: disableContextMenu
470
+ disableContextMenu: disableContextMenu,
471
+ dateLocale: dateLocale,
472
+ numberLocale: numberLocale
428
473
  };
429
474
 
430
475
  tableRows.push(_react2.default.createElement(_BodyRow2.default, (0, _extends3.default)({ key: row.rowId + '-' + detailRow.rowId }, detailRowProps)));
@@ -453,6 +498,31 @@ var HiTableBody = function (_React$Component) {
453
498
  })
454
499
  );
455
500
  }
501
+ }], [{
502
+ key: 'getDerivedStateFromProps',
503
+ value: function getDerivedStateFromProps(props, state) {
504
+ var nextState = {};
505
+ if (props.groupBy && props.dataSource && props.dataSource.length > 0) {
506
+ if ((0, _stringify2.default)(props.dataSource) !== (0, _stringify2.default)(state.dataSource)) {
507
+ var groupByIds = {};
508
+ props.dataSource.map(function (row) {
509
+ var value = row.datas[props.groupBy].value;
510
+ if (!groupByIds.hasOwnProperty(value)) {
511
+ groupByIds[value] = [];
512
+ }
513
+ groupByIds[value].push(row.datas);
514
+ });
515
+ nextState.groupByIds = groupByIds;
516
+ }
517
+ }
518
+ if ((0, _stringify2.default)(props.dataSource) !== (0, _stringify2.default)(state.dataSource)) {
519
+ nextState.dataSource = props.dataSource;
520
+ }
521
+ if ((0, _values2.default)(nextState).length > 0) {
522
+ return nextState;
523
+ }
524
+ return null;
525
+ }
456
526
  }]);
457
527
  return HiTableBody;
458
528
  }(_react2.default.Component);
@@ -88,7 +88,9 @@ var HiTableContextMenu = function (_React$Component) {
88
88
 
89
89
  _this.state = {
90
90
  value: '',
91
- label: ''
91
+ label: '',
92
+ lookup: true,
93
+ exclude: true
92
94
  };
93
95
 
94
96
  _this.handleContextMenuOpen = _this.handleContextMenuOpen.bind(_this);
@@ -102,9 +104,13 @@ var HiTableContextMenu = function (_React$Component) {
102
104
  (0, _createClass3.default)(HiTableContextMenu, [{
103
105
  key: 'handleContextMenuOpen',
104
106
  value: function handleContextMenuOpen(event) {
107
+ var columns = this.props.columns;
108
+
105
109
  this.setState({
106
110
  value: event.detail.data.value,
107
- label: event.detail.data.label
111
+ label: event.detail.data.label,
112
+ lookup: columns[event.detail.data.column].lookup !== false,
113
+ exclude: columns[event.detail.data.column].exclude !== false
108
114
  });
109
115
  }
110
116
  }, {
@@ -144,9 +150,12 @@ var HiTableContextMenu = function (_React$Component) {
144
150
  classes = _props.classes,
145
151
  tabId = _props.tabId,
146
152
  translations = _props.translations;
153
+ var _state = this.state,
154
+ lookup = _state.lookup,
155
+ exclude = _state.exclude;
147
156
 
148
157
 
149
- var contextMenuItems = [{ id: 'copy', icon: 'contentDuplicate', title: translations.copy, action: this.handleClickCopy }, { id: 'lookup', icon: 'crosshairsGps', title: translations.lookUp, action: this.handleClickLookup }, { id: 'exclude', icon: 'closeCircleOutline', title: translations.exclude, action: this.handleClickExclude }, { id: 'open', icon: 'openInNew', title: translations.openInNewTab, action: this.handleClickOpenNewTab }];
158
+ var contextMenuItems = [{ id: 'copy', icon: 'contentDuplicate', title: translations.copy, action: this.handleClickCopy }, { id: 'lookup', displayed: lookup, icon: 'crosshairsGps', title: translations.lookUp, action: this.handleClickLookup }, { id: 'exclude', displayed: exclude, icon: 'closeCircleOutline', title: translations.exclude, action: this.handleClickExclude }, { id: 'open', icon: 'openInNew', title: translations.openInNewTab, action: this.handleClickOpenNewTab }];
150
159
 
151
160
  return _react2.default.createElement(
152
161
  _reactContextmenu.ContextMenu,
@@ -156,19 +165,21 @@ var HiTableContextMenu = function (_React$Component) {
156
165
  onShow: this.handleContextMenuOpen
157
166
  },
158
167
  contextMenuItems.map(function (menuItem) {
159
- return _react2.default.createElement(
160
- _reactContextmenu.MenuItem,
161
- {
162
- attributes: { className: classes.contextMenuItem },
163
- key: 'hitable_context_menu_' + tabId + '_' + menuItem.id,
164
- onClick: menuItem.action },
165
- _react2.default.createElement(_HiIconBuilder2.default, { icon: menuItem.icon }),
166
- _react2.default.createElement(
167
- 'span',
168
- { className: classes.title },
169
- menuItem.title.replace('%s', _this2.state.label)
170
- )
171
- );
168
+ if (menuItem.displayed !== false) {
169
+ return _react2.default.createElement(
170
+ _reactContextmenu.MenuItem,
171
+ {
172
+ attributes: { className: classes.contextMenuItem },
173
+ key: 'hitable_context_menu_' + tabId + '_' + menuItem.id,
174
+ onClick: menuItem.action },
175
+ _react2.default.createElement(_HiIconBuilder2.default, { icon: menuItem.icon }),
176
+ _react2.default.createElement(
177
+ 'span',
178
+ { className: classes.title },
179
+ menuItem.title.replace('%s', _this2.state.label)
180
+ )
181
+ );
182
+ }
172
183
  })
173
184
  );
174
185
  }
@@ -189,6 +200,10 @@ HiTableContextMenu.propTypes = process.env.NODE_ENV !== "production" ? {
189
200
  * Surcharge le style du composant
190
201
  */
191
202
  classes: _propTypes2.default.object,
203
+ /**
204
+ * Liste des objets colonnes utilisé pour savoir quels items du context menu sont affichés
205
+ */
206
+ columns: _propTypes2.default.object.isRequired,
192
207
  /**
193
208
  * Fonction de callback appelée au clic sur l'item redirection
194
209
  * du menu contextuel ouvert au clic droit