@hipay/hipay-material-ui 1.0.0-beta.27 → 1.0.0-beta.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/HiCheckbox/HiCheckbox.js +6 -3
  2. package/HiColoredLabel/HiColoredLabel.js +2 -2
  3. package/HiDatePicker/HiDateRangeSelector.js +32 -9
  4. package/HiForm/HiSearchField.js +7 -1
  5. package/HiSelect/HiSelect.js +187 -77
  6. package/HiSelect/HiSuggestSelect.js +22 -6
  7. package/HiSelect/SelectInput.js +63 -10
  8. package/HiSelectableList/HiSelectableListItem.js +2 -1
  9. package/HiTable/BodyCellBuilder.js +22 -16
  10. package/HiTable/BodyCells/CellAccount.js +1 -5
  11. package/HiTable/BodyCells/CellAddress.js +3 -50
  12. package/HiTable/BodyCells/CellCountry.js +0 -4
  13. package/HiTable/BodyCells/CellDate.js +4 -13
  14. package/HiTable/BodyCells/CellIcon.js +10 -27
  15. package/HiTable/BodyCells/CellImage.js +1 -21
  16. package/HiTable/BodyCells/CellLayout.js +11 -4
  17. package/HiTable/BodyCells/CellNumeric.js +3 -23
  18. package/HiTable/BodyCells/CellSentinel.js +20 -49
  19. package/HiTable/BodyCells/CellStatus.js +11 -19
  20. package/HiTable/BodyCells/CellText.js +3 -10
  21. package/HiTable/BodyCells/CellThirdPartySecurity.js +4 -18
  22. package/HiTable/BodyCells/index.js +0 -9
  23. package/HiTable/BodyRow.js +15 -17
  24. package/HiTable/HiTable.js +41 -26
  25. package/HiTable/HiTableBody.js +2 -1
  26. package/HiTable/HiTableContextMenu.js +4 -3
  27. package/HiTable/constants.js +2 -2
  28. package/es/HiCheckbox/HiCheckbox.js +6 -3
  29. package/es/HiColoredLabel/HiColoredLabel.js +2 -2
  30. package/es/HiDatePicker/HiDateRangeSelector.js +27 -9
  31. package/es/HiForm/HiSearchField.js +2 -1
  32. package/es/HiSelect/HiSelect.js +133 -36
  33. package/es/HiSelect/HiSuggestSelect.js +22 -7
  34. package/es/HiSelect/SelectInput.js +50 -10
  35. package/es/HiSelectableList/HiSelectableListItem.js +2 -1
  36. package/es/HiTable/BodyCellBuilder.js +21 -19
  37. package/es/HiTable/BodyCells/CellAccount.js +1 -5
  38. package/es/HiTable/BodyCells/CellAddress.js +3 -44
  39. package/es/HiTable/BodyCells/CellCountry.js +0 -2
  40. package/es/HiTable/BodyCells/CellDate.js +4 -10
  41. package/es/HiTable/BodyCells/CellIcon.js +10 -24
  42. package/es/HiTable/BodyCells/CellImage.js +1 -21
  43. package/es/HiTable/BodyCells/CellLayout.js +10 -4
  44. package/es/HiTable/BodyCells/CellNumeric.js +3 -16
  45. package/es/HiTable/BodyCells/CellSentinel.js +20 -46
  46. package/es/HiTable/BodyCells/CellStatus.js +11 -16
  47. package/es/HiTable/BodyCells/CellText.js +3 -7
  48. package/es/HiTable/BodyCells/CellThirdPartySecurity.js +3 -15
  49. package/es/HiTable/BodyCells/index.js +0 -2
  50. package/es/HiTable/BodyRow.js +12 -14
  51. package/es/HiTable/HiTable.js +41 -26
  52. package/es/HiTable/HiTableBody.js +2 -1
  53. package/es/HiTable/HiTableContextMenu.js +4 -3
  54. package/es/HiTable/constants.js +7 -7
  55. package/es/utils/HiIconBuilder.js +12 -4
  56. package/es/utils/hiHelpers.js +1 -1
  57. package/index.es.js +1 -1
  58. package/index.js +1 -1
  59. package/package.json +1 -1
  60. package/umd/hipay-material-ui.development.js +9073 -9614
  61. package/umd/hipay-material-ui.production.min.js +5 -5
  62. package/utils/HiIconBuilder.js +13 -3
  63. package/utils/hiHelpers.js +1 -1
  64. package/HiTable/BodyCells/CellAccountNumber.js +0 -229
  65. package/es/HiTable/BodyCells/CellAccountNumber.js +0 -171
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.styles = undefined;
6
+ exports.styles = exports.INFINITESCROLL_ERROR_MESSAGE = undefined;
7
7
 
8
8
  var _keys = require('babel-runtime/core-js/object/keys');
9
9
 
@@ -17,6 +17,10 @@ var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
17
17
 
18
18
  var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
19
19
 
20
+ var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
21
+
22
+ var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
23
+
20
24
  var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
21
25
 
22
26
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
@@ -71,6 +75,10 @@ var _reactPopper = require('react-popper');
71
75
 
72
76
  var _mdiMaterialUi = require('mdi-material-ui');
73
77
 
78
+ var _reactProptypeConditionalRequire = require('react-proptype-conditional-require');
79
+
80
+ var _reactProptypeConditionalRequire2 = _interopRequireDefault(_reactProptypeConditionalRequire);
81
+
74
82
  var _HiSelectableList = require('../HiSelectableList');
75
83
 
76
84
  var _HiSelectableList2 = _interopRequireDefault(_HiSelectableList);
@@ -95,7 +103,7 @@ var _HiIconBuilder2 = _interopRequireDefault(_HiIconBuilder);
95
103
 
96
104
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
97
105
 
98
- // @inheritedComponent Input
106
+ var INFINITESCROLL_ERROR_MESSAGE = exports.INFINITESCROLL_ERROR_MESSAGE = 'La propriété "loadMoreResults" est obligatoire si la prop "infiniteScroll" est à true'; // @inheritedComponent Input
99
107
 
100
108
  var styles = exports.styles = function styles(theme) {
101
109
  return {
@@ -162,7 +170,8 @@ var HiSelect = function (_React$PureComponent) {
162
170
  hierarchySelected: {},
163
171
  hierarchy: {},
164
172
  nbOptions: 0,
165
- dynamic: props.dynamic || false
173
+ dynamic: props.dynamic || false,
174
+ resultsPageNumber: 1
166
175
  };
167
176
 
168
177
  // Check if value is in options
@@ -221,6 +230,24 @@ var HiSelect = function (_React$PureComponent) {
221
230
  }
222
231
 
223
232
  (0, _createClass3.default)(HiSelect, [{
233
+ key: 'componentDidUpdate',
234
+ value: function componentDidUpdate(prevProps, prevState, prevContext) {
235
+ var _this2 = this;
236
+
237
+ if (this.props.infiniteScroll && !prevState.open && this.state.open && this.optionsContent) {
238
+ var optionList = this.optionsContent.querySelector('div').querySelector('div');
239
+ optionList.addEventListener('scroll', function (event) {
240
+ if (optionList.scrollTop >= event.target.scrollHeight - optionList.offsetHeight && !_this2.props.loadingMoreResults && _this2.props.hasMore) {
241
+ _this2.props.loadMoreResults(_this2.state.resultsPageNumber + 1);
242
+ _this2.setState({ resultsPageNumber: _this2.state.resultsPageNumber + 1 });
243
+ }
244
+ });
245
+ } else if (this.optionsContent && this.props.infiniteScroll && !this.state.open && prevState.open) {
246
+ var _optionList = this.optionsContent.querySelector('div').querySelector('div');
247
+ _optionList.removeEventListener('scroll');
248
+ }
249
+ }
250
+ }, {
224
251
  key: 'componentWillReceiveProps',
225
252
  value: function componentWillReceiveProps(nextProps) {
226
253
  if (typeof this.props.onSearch !== 'undefined' && this.props.options && this.props.options.length > 0) {
@@ -262,6 +289,14 @@ var HiSelect = function (_React$PureComponent) {
262
289
  });
263
290
  return { hierarchy: hierarchy, hierarchySelected: hierarchySelected };
264
291
  }
292
+ }, {
293
+ key: 'handleReset',
294
+ value: function handleReset(event) {
295
+ if (this.props.onReset) {
296
+ event.stopPropagation();
297
+ this.props.onReset(event);
298
+ }
299
+ }
265
300
 
266
301
  // Key down on list items
267
302
 
@@ -291,7 +326,7 @@ var HiSelect = function (_React$PureComponent) {
291
326
  }, {
292
327
  key: 'render',
293
328
  value: function render() {
294
- var _this2 = this;
329
+ var _this3 = this;
295
330
 
296
331
  var _props = this.props,
297
332
  classes = _props.classes,
@@ -315,7 +350,12 @@ var HiSelect = function (_React$PureComponent) {
315
350
  placeholder = _props.placeholder,
316
351
  staticPosition = _props.staticPosition,
317
352
  pinnedItem = _props.pinnedItem,
318
- hasAll = _props.hasAll;
353
+ hasAll = _props.hasAll,
354
+ infiniteScroll = _props.infiniteScroll,
355
+ loadingMoreResults = _props.loadingMoreResults,
356
+ showNoResults = _props.showNoResults,
357
+ showMinLength = _props.showMinLength,
358
+ other = (0, _objectWithoutProperties3.default)(_props, ['classes', 'disabled', 'error', 'loading', 'options', 'checkbox', 'searchable', 'displayAsChip', 'type', 'value', 'translations', 'parentItemSelectable', 'icon', 'parentIcon', 'hoverIcon', 'checkedIcon', 'hierarchic', 'id', 'placeholder', 'staticPosition', 'pinnedItem', 'hasAll', 'infiniteScroll', 'loadingMoreResults', 'showNoResults', 'showMinLength']);
319
359
  var _state = this.state,
320
360
  open = _state.open,
321
361
  suggestions = _state.suggestions,
@@ -333,7 +373,7 @@ var HiSelect = function (_React$PureComponent) {
333
373
  }
334
374
 
335
375
  // If loading
336
- if (loading) {
376
+ if (loading && !loadingMoreResults) {
337
377
  _suggestions.unshift({
338
378
  id: '_loading',
339
379
  type: 'loader',
@@ -390,6 +430,28 @@ var HiSelect = function (_React$PureComponent) {
390
430
  popperStyle = { width: this.props.containerWidth };
391
431
  }
392
432
 
433
+ if (infiniteScroll && loadingMoreResults) {
434
+ _suggestions.push({
435
+ id: '_loading',
436
+ type: 'loader',
437
+ disabled: true,
438
+ centered: true,
439
+ checkbox: false,
440
+ label: 'loading'
441
+ });
442
+ }
443
+
444
+ if (!loading && !loadingMoreResults && _suggestions.length === 0 && (showNoResults || showMinLength)) {
445
+ suggestions.push({
446
+ id: '_no_result',
447
+ type: 'text',
448
+ disabled: true,
449
+ centered: true,
450
+ checkbox: false,
451
+ label: showNoResults ? translations.no_result_match : translations.min_length
452
+ });
453
+ }
454
+
393
455
  var content = _react2.default.createElement(
394
456
  _ClickAwayListener2.default,
395
457
  { onClickAway: this.handleClickAway },
@@ -407,29 +469,35 @@ var HiSelect = function (_React$PureComponent) {
407
469
  autoFocus: true,
408
470
  onSearch: this.props.onSearch,
409
471
  inputRef: function inputRef(el) {
410
- _this2.searchField = el;
472
+ _this3.searchField = el;
411
473
  },
412
474
  onKeyDown: this.handleKeyDownSearch
413
475
  }),
414
- _react2.default.createElement(_HiSelectableList2.default, {
415
- type: type,
416
- parentItemSelectable: parentItemSelectable,
417
- itemList: _suggestions,
418
- onSelect: this.handleSelect,
419
- selectedIdList: selectedIdList,
420
- checkbox: checkbox,
421
- hierarchy: this.state.hierarchy,
422
- hierarchic: hierarchic,
423
- hierarchySelected: this.state.hierarchySelected,
424
- translations: translations,
425
- icon: icon,
426
- parentIcon: parentIcon,
427
- hoverIcon: hoverIcon,
428
- checkedIcon: checkedIcon,
429
- allSelected: allSelected,
430
- value: value,
431
- onKeyDown: this.handleKeyDown
432
- })
476
+ _react2.default.createElement(
477
+ 'div',
478
+ { ref: function ref(content) {
479
+ return _this3.optionsContent = content;
480
+ } },
481
+ _react2.default.createElement(_HiSelectableList2.default, (0, _extends3.default)({
482
+ type: type,
483
+ parentItemSelectable: parentItemSelectable,
484
+ itemList: _suggestions,
485
+ onSelect: this.handleSelect,
486
+ selectedIdList: selectedIdList,
487
+ checkbox: checkbox,
488
+ hierarchy: this.state.hierarchy,
489
+ hierarchic: hierarchic,
490
+ hierarchySelected: this.state.hierarchySelected,
491
+ translations: translations,
492
+ icon: icon,
493
+ parentIcon: parentIcon,
494
+ hoverIcon: hoverIcon,
495
+ checkedIcon: checkedIcon,
496
+ allSelected: allSelected,
497
+ value: value,
498
+ onKeyDown: this.handleKeyDown
499
+ }, other))
500
+ )
433
501
  )
434
502
  )
435
503
  );
@@ -439,7 +507,7 @@ var HiSelect = function (_React$PureComponent) {
439
507
  {
440
508
  className: classes.root,
441
509
  ref: function ref(el) {
442
- _this2.overlay = el;
510
+ _this3.overlay = el;
443
511
  }
444
512
  },
445
513
  _react2.default.createElement(
@@ -463,8 +531,10 @@ var HiSelect = function (_React$PureComponent) {
463
531
  onMouseEnter: this.props.onMouseEnter,
464
532
  onMouseLeave: this.props.onMouseLeave,
465
533
  refElement: function refElement(el) {
466
- _this2.selectInputElement = el;
467
- }
534
+ _this3.selectInputElement = el;
535
+ },
536
+ onSubmit: this.props.onSubmit,
537
+ onReset: this.props.onReset
468
538
  })
469
539
  ),
470
540
  open && (staticPosition ? _react2.default.createElement(
@@ -501,12 +571,14 @@ HiSelect.defaultProps = {
501
571
  parentItemSelectable: false,
502
572
  displayAsChip: false,
503
573
  dynamic: false,
574
+ infiniteScroll: false,
504
575
  icon: _react2.default.createElement(_mdiMaterialUi.CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
505
576
  parentIcon: _react2.default.createElement(_mdiMaterialUi.CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
506
577
  hoverIcon: _react2.default.createElement(_mdiMaterialUi.CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
507
578
  checkedIcon: _react2.default.createElement(_mdiMaterialUi.CheckboxMarked, { style: { width: 20, height: 20 } }),
508
579
  translations: {
509
580
  all: 'All',
581
+ min_length: 'Veuillez saisir 3 caractères minimum',
510
582
  no_result_match: 'No result match',
511
583
  search: 'Search',
512
584
  n_items_selected: '%s items selected',
@@ -514,46 +586,42 @@ HiSelect.defaultProps = {
514
586
  n_children: '%s items',
515
587
  one_child: '%s item'
516
588
  },
517
- staticPosition: false
589
+ staticPosition: false,
590
+ loadingMoreResults: false,
591
+ hasMore: false
518
592
  };
519
593
 
520
594
  var _initialiseProps = function _initialiseProps() {
521
- var _this3 = this;
595
+ var _this4 = this;
522
596
 
523
597
  this.handleClick = function () {
524
- if (_this3.state.open) {
525
- _this3.handleClose();
598
+ if (_this4.state.open) {
599
+ _this4.handleClose();
526
600
  } else {
527
601
  /*if (!this.props.staticPosition) {
528
602
  // document.body.style.overflow = 'hidden';
529
603
  }*/
530
- _this3.setState({ open: true });
531
- var options = _this3.props.options.slice();
532
- _this3.handleSuggestions(options);
604
+ _this4.setState({ open: true });
605
+ var options = _this4.props.options.slice();
606
+ _this4.handleSuggestions(options);
533
607
 
534
- if (_this3.props.onClick) {
535
- _this3.props.onClick();
608
+ if (_this4.props.onClick) {
609
+ _this4.props.onClick();
536
610
  }
537
611
 
538
612
  // Gestion du focus
539
- if (_this3.searchField) {
540
- // si searchable, focus sur le champs de recherche
541
- var searchField = _this3.searchField;
542
- setTimeout(function () {
543
- searchField.focus();
544
- }, 1);
545
- } else if (_this3.overlay) {
613
+ if (!_this4.props.searchable) {
546
614
  // sinon focus sur le dernier élément selectionné
547
- _this3.focusOnSelectedItem();
615
+ _this4.focusOnSelectedItem();
548
616
  }
549
617
  }
550
618
  };
551
619
 
552
620
  this.focusOnSelectedItem = function () {
553
621
  // On récupère la div parent "overlay"
554
- var overlay = (0, _reactDom.findDOMNode)(_this3.overlay);
555
- var multiple = _this3.props.multiple;
556
- var value = _this3.props.value;
622
+ var overlay = (0, _reactDom.findDOMNode)(_this4.overlay);
623
+ var multiple = _this4.props.multiple;
624
+ var value = _this4.props.value;
557
625
  var selectedIdList = Array.isArray(value) ? value : [value];
558
626
  setTimeout(function () {
559
627
  var focused = false;
@@ -591,9 +659,9 @@ var _initialiseProps = function _initialiseProps() {
591
659
  /* if (!this.props.staticPosition) {
592
660
  document.body.style.overflow = 'auto';
593
661
  } */
594
- _this3.setState({ open: false });
662
+ _this4.setState({ open: false });
595
663
  } else if (event.key === 'Escape') {
596
- _this3.setState({ open: false });
664
+ _this4.setState({ open: false });
597
665
  }
598
666
  if (nextItem) {
599
667
  nextItem.focus();
@@ -601,51 +669,53 @@ var _initialiseProps = function _initialiseProps() {
601
669
  };
602
670
 
603
671
  this.handleKeyDownSearch = function (event) {
604
- if (_this3.overlay && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
605
- _this3.focusOnSelectedItem();
672
+ if (_this4.overlay && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
673
+ _this4.focusOnSelectedItem();
674
+ } else if (event.key === 'Enter' && _this4.props.onSubmit) {
675
+ _this4.props.onSubmit(event);
606
676
  }
607
677
  };
608
678
 
609
679
  this.handleFocus = function () {
610
- _this3.setState({ focused: true });
680
+ _this4.setState({ focused: true });
611
681
  };
612
682
 
613
683
  this.handleBlur = function () {
614
- _this3.setState({ focused: false });
684
+ _this4.setState({ focused: false });
615
685
  };
616
686
 
617
687
  this.handleClose = function () {
618
- if (!_this3.props.staticPosition) {
688
+ if (!_this4.props.staticPosition) {
619
689
  //document.body.style.overflow = 'auto';
620
690
  }
621
- _this3.setState({
691
+ _this4.setState({
622
692
  open: false
623
693
  });
624
694
 
625
- if (_this3.props.onClose) {
626
- _this3.props.onClose();
695
+ if (_this4.props.onClose) {
696
+ _this4.props.onClose();
627
697
  }
628
- if (_this3.selectInputElement) {
629
- _this3.selectInputElement.focus();
698
+ if (_this4.selectInputElement) {
699
+ _this4.selectInputElement.focus();
630
700
  }
631
701
  };
632
702
 
633
703
  this.handleClickAway = function (event) {
634
704
  // Au clic sur le bouton, on laisse le handleClick fermer le select
635
- if (!_this3.selectInputElement.contains(event.target)) {
636
- _this3.handleClose(event);
705
+ if (!_this4.selectInputElement.contains(event.target)) {
706
+ _this4.handleClose(event);
637
707
  }
638
708
  };
639
709
 
640
710
  this.handleSelect = function (event, item) {
641
- var _props2 = _this3.props,
711
+ var _props2 = _this4.props,
642
712
  multiple = _props2.multiple,
643
713
  value = _props2.value,
644
714
  onChange = _props2.onChange,
645
715
  options = _props2.options,
646
716
  hierarchic = _props2.hierarchic,
647
717
  pinnedItem = _props2.pinnedItem;
648
- var _state2 = _this3.state,
718
+ var _state2 = _this4.state,
649
719
  hierarchySelected = _state2.hierarchySelected,
650
720
  hierarchy = _state2.hierarchy,
651
721
  nbOptions = _state2.nbOptions;
@@ -684,7 +754,7 @@ var _initialiseProps = function _initialiseProps() {
684
754
  if (item.hasChildren === true) {
685
755
  // remove all children
686
756
  valueList = valueList.filter(function (val) {
687
- return !_this3.state.hierarchy[item.id].includes(val);
757
+ return !_this4.state.hierarchy[item.id].includes(val);
688
758
  });
689
759
  hiSelected[item.id] = [];
690
760
  } else if (item.hasOwnProperty('parentId')) {
@@ -712,8 +782,8 @@ var _initialiseProps = function _initialiseProps() {
712
782
  // Si item parent => on ajoute tous les enfants
713
783
  // Ou on les supprime s'ils sont déjà tous sélectionnés (dans une liste filtrée)
714
784
  var idsInSuggestions = [];
715
- _this3.state.suggestions.forEach(function (suggestion) {
716
- if (_this3.state.hierarchy[item.id].includes(suggestion.id)) {
785
+ _this4.state.suggestions.forEach(function (suggestion) {
786
+ if (_this4.state.hierarchy[item.id].includes(suggestion.id)) {
717
787
  idsInSuggestions.push(suggestion.id);
718
788
  }
719
789
  });
@@ -737,31 +807,33 @@ var _initialiseProps = function _initialiseProps() {
737
807
  hiSelected[item.id] = (0, _hiHelpers.arrayUnique)(hiSelected[item.id].concat(idsInSuggestions));
738
808
  }
739
809
 
740
- _this3.setState({ hierarchySelected: hiSelected });
810
+ _this4.setState({ hierarchySelected: hiSelected });
741
811
  } else if (item.hasOwnProperty('parentId')) {
742
812
  // Si item est un enfant on l'ajoute du tableau associatif des
743
813
  // elmts sélectionnés
744
814
  hiSelected[item.parentId].push(item.id);
745
815
  }
746
816
  }
747
- _this3.setState({ hierarchySelected: hiSelected });
817
+ _this4.setState({ hierarchySelected: hiSelected });
748
818
  onChange(event, valueList, item);
749
819
  } else {
750
820
  onChange(event, item.id, item);
751
- _this3.handleClose();
821
+ _this4.handleClose();
752
822
  }
753
823
  };
754
824
 
755
825
  this.handleSuggestions = function (suggestions) {
756
- var _props3 = _this3.props,
826
+ var _props3 = _this4.props,
757
827
  options = _props3.options,
758
828
  hasAll = _props3.hasAll,
759
829
  iconAll = _props3.iconAll,
760
830
  translations = _props3.translations,
761
- multiple = _props3.multiple;
831
+ multiple = _props3.multiple,
832
+ showNoResults = _props3.showNoResults,
833
+ showMinLength = _props3.showMinLength;
762
834
 
763
835
 
764
- if (suggestions.length === 0) {
836
+ if (suggestions.length === 0 && (showNoResults || showMinLength)) {
765
837
  // Handle No Result
766
838
  // FIX to remove all item
767
839
  suggestions = [];
@@ -771,7 +843,7 @@ var _initialiseProps = function _initialiseProps() {
771
843
  disabled: true,
772
844
  centered: true,
773
845
  checkbox: false,
774
- label: translations.no_result_match
846
+ label: showNoResults ? translations.no_result_match : translations.min_length
775
847
  });
776
848
  } else if (hasAll && suggestions.length > 0 && suggestions.length === options.length && multiple === true) {
777
849
  // Handle 'All'
@@ -790,14 +862,14 @@ var _initialiseProps = function _initialiseProps() {
790
862
  }
791
863
  }
792
864
 
793
- _this3.setState({
865
+ _this4.setState({
794
866
  suggestions: suggestions
795
867
  });
796
868
  };
797
869
 
798
870
  this.handleRequestDelete = function (evt) {
799
871
  evt.stopPropagation();
800
- _this3.props.onChange(_this3.props.name, []);
872
+ _this4.props.onChange(_this4.props.name, []);
801
873
  };
802
874
  };
803
875
 
@@ -840,6 +912,10 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
840
912
  * Les items sont hiérarchisés
841
913
  */
842
914
  hierarchic: _propTypes2.default.bool,
915
+ /**
916
+ * Indique si l'infinite scroll doit rechercher de nouveaux résultats
917
+ */
918
+ hasMore: _propTypes2.default.bool,
843
919
  /**
844
920
  * Icon affiché lorsque l'item n'est pas sélectionné et qu'on le survole
845
921
  */
@@ -856,10 +932,28 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
856
932
  * id du select
857
933
  */
858
934
  id: _propTypes2.default.string,
935
+ /**
936
+ * Infinite scroll dans le select dans le cas où il y a beaucoup de résultats à afficher
937
+ * afin d'éviter un lag du navigateur
938
+ */
939
+ infiniteScroll: _propTypes2.default.bool.isRequired,
859
940
  /**
860
941
  * Ajoute un loader
861
942
  */
862
943
  loading: _propTypes2.default.bool,
944
+ /**
945
+ * Ajoute un loader en bas pour l'infiniteScroll
946
+ */
947
+ loadingMoreResults: _propTypes2.default.bool,
948
+ /**
949
+ * Fonction de callback appelée lorsque l'utilisateur arrive en bas de la liste des options
950
+ * afin de charger les nouvelles options
951
+ *
952
+ * @param {int} pageNumber
953
+ */
954
+ loadMoreResults: (0, _reactProptypeConditionalRequire2.default)(_propTypes2.default.func, function (props) {
955
+ return props.hasOwnProperty('infiniteScroll') && props.infiniteScroll === true;
956
+ }, INFINITESCROLL_ERROR_MESSAGE),
863
957
  /**
864
958
  * Autorise la sélection de plusieurs valeurs
865
959
  */
@@ -887,6 +981,10 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
887
981
  * Fonction de callback appelée lorsque le curseur quitte le champs
888
982
  */
889
983
  onMouseLeave: _propTypes2.default.func,
984
+ /**
985
+ * Fonction de callback appelée lorsqu'on vide le champs
986
+ */
987
+ onReset: _propTypes2.default.func,
890
988
  /**
891
989
  * Fonction de callback appelée lorsqu'on écrit dans la barre de recherche
892
990
  * A utiliser pour les selects avec des données dynamiques
@@ -895,6 +993,10 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
895
993
  * @param {string} value
896
994
  */
897
995
  onSearch: _propTypes2.default.func,
996
+ /**
997
+ * Fonction de callback à la pression de la touche "Entrée"
998
+ */
999
+ onSubmit: _propTypes2.default.func,
898
1000
  /**
899
1001
  * Listes des options du select
900
1002
  */
@@ -924,6 +1026,14 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
924
1026
  * Si true, le contenu du select sera dans une div static plutot que dans une popper absolute
925
1027
  */
926
1028
  staticPosition: _propTypes2.default.bool,
1029
+ /**
1030
+ * Permet d'afficher un message si pas assez de caractères
1031
+ */
1032
+ showMinLength: _propTypes2.default.bool,
1033
+ /**
1034
+ * Permet d'afficher un message si aucune options n'est présente
1035
+ */
1036
+ showNoResults: _propTypes2.default.bool,
927
1037
  /**
928
1038
  * Traductions (par défaut en anglais)
929
1039
  */
@@ -187,11 +187,12 @@ var HiSuggestSelect = function (_React$PureComponent) {
187
187
  var _props = this.props,
188
188
  classes = _props.classes,
189
189
  id = _props.id,
190
+ loading = _props.loading,
190
191
  showMinLength = _props.showMinLength,
191
192
  showNoResults = _props.showNoResults,
192
193
  onSearch = _props.onSearch,
193
194
  translations = _props.translations,
194
- otherProps = (0, _objectWithoutProperties3.default)(_props, ['classes', 'id', 'showMinLength', 'showNoResults', 'onSearch', 'translations']);
195
+ otherProps = (0, _objectWithoutProperties3.default)(_props, ['classes', 'id', 'loading', 'showMinLength', 'showNoResults', 'onSearch', 'translations']);
195
196
  var _state = this.state,
196
197
  focused = _state.focused,
197
198
  options = _state.options;
@@ -199,17 +200,28 @@ var HiSuggestSelect = function (_React$PureComponent) {
199
200
 
200
201
  var optionsShown = options;
201
202
 
202
- // If no results match
203
- if (options.length === 0 && (showNoResults || showMinLength)) {
203
+ // If loading
204
+ if (loading) {
204
205
  optionsShown = [{
205
- id: '_no_result',
206
- type: 'text',
206
+ id: '_loading',
207
+ type: 'loader',
207
208
  disabled: true,
208
209
  centered: true,
209
210
  checkbox: false,
210
- label: showNoResults ? translations.no_result_match : translations.min_length
211
+ label: 'loading'
211
212
  }];
212
213
  }
214
+ // If no results match
215
+ else if (options.length === 0 && (showNoResults || showMinLength)) {
216
+ optionsShown = [{
217
+ id: '_no_result',
218
+ type: 'text',
219
+ disabled: true,
220
+ centered: true,
221
+ checkbox: false,
222
+ label: showNoResults ? translations.no_result_match : translations.min_length
223
+ }];
224
+ }
213
225
 
214
226
  var open = !!optionsShown.length && focused;
215
227
 
@@ -289,6 +301,10 @@ HiSuggestSelect.propTypes = process.env.NODE_ENV !== "production" ? {
289
301
  * id de l'élément input
290
302
  */
291
303
  id: _propTypes2.default.string,
304
+ /**
305
+ * Ajoute un loader
306
+ */
307
+ loading: _propTypes2.default.bool,
292
308
  /**
293
309
  * Fonction de callback appelée lorsqu'on écrit dans le champ
294
310
  */