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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -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);
@@ -78,6 +82,11 @@ var HiTableFooter = function (_React$Component) {
78
82
  }
79
83
 
80
84
  (0, _createClass3.default)(HiTableFooter, [{
85
+ key: 'shouldComponentUpdate',
86
+ value: function shouldComponentUpdate(nextProps, nextState) {
87
+ return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
88
+ }
89
+ }, {
81
90
  key: 'render',
82
91
  value: function render() {
83
92
  var _props = this.props,
@@ -13,6 +13,10 @@ var _extends2 = require('babel-runtime/helpers/extends');
13
13
 
14
14
  var _extends3 = _interopRequireDefault(_extends2);
15
15
 
16
+ var _stringify = require('babel-runtime/core-js/json/stringify');
17
+
18
+ var _stringify2 = _interopRequireDefault(_stringify);
19
+
16
20
  var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
17
21
 
18
22
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
@@ -163,13 +167,13 @@ var HiTableHead = function (_React$Component) {
163
167
 
164
168
  var _this = (0, _possibleConstructorReturn3.default)(this, (HiTableHead.__proto__ || (0, _getPrototypeOf2.default)(HiTableHead)).call(this));
165
169
 
170
+ _this.orderColumnsAnchorEl = null;
166
171
  _this.orderColumnsButton = null;
167
172
 
168
173
 
169
174
  _this.state = {
170
175
  hovered: false,
171
- openedOrderColumns: false,
172
- orderColumnsAnchorEl: null
176
+ openedOrderColumns: false
173
177
  };
174
178
 
175
179
  _this.handleEvent = _this.handleEvent.bind(_this);
@@ -179,6 +183,11 @@ var HiTableHead = function (_React$Component) {
179
183
  }
180
184
 
181
185
  (0, _createClass3.default)(HiTableHead, [{
186
+ key: 'shouldComponentUpdate',
187
+ value: function shouldComponentUpdate(nextProps, nextState) {
188
+ return (0, _stringify2.default)(this.props) !== (0, _stringify2.default)(nextProps) || (0, _stringify2.default)(this.state) !== (0, _stringify2.default)(nextState);
189
+ }
190
+ }, {
182
191
  key: 'handleEvent',
183
192
  value: function handleEvent(_ref) {
184
193
  var type = _ref.type;
@@ -196,9 +205,9 @@ var HiTableHead = function (_React$Component) {
196
205
  key: 'handleOpenOrderColumns',
197
206
  value: function handleOpenOrderColumns() {
198
207
  this.setState({
199
- openedOrderColumns: true,
200
- orderColumnsAnchorEl: (0, _reactDom.findDOMNode)(this.orderColumnsButton)
208
+ openedOrderColumns: true
201
209
  });
210
+ this.orderColumnsAnchorEl = (0, _reactDom.findDOMNode)(this.orderColumnsButton);
202
211
  }
203
212
  }, {
204
213
  key: 'handleCloseOrderColumns',
@@ -240,8 +249,7 @@ var HiTableHead = function (_React$Component) {
240
249
  fixedColumnWidth = _props.fixedColumnWidth;
241
250
  var _state = this.state,
242
251
  hovered = _state.hovered,
243
- openedOrderColumns = _state.openedOrderColumns,
244
- orderColumnsAnchorEl = _state.orderColumnsAnchorEl;
252
+ openedOrderColumns = _state.openedOrderColumns;
245
253
 
246
254
 
247
255
  var headerProps = (0, _extends3.default)({
@@ -343,7 +351,7 @@ var HiTableHead = function (_React$Component) {
343
351
  orderable && _react2.default.createElement(_OrderColumns2.default, {
344
352
  isOpen: openedOrderColumns,
345
353
  onClose: this.handleCloseOrderColumns,
346
- anchorEl: orderColumnsAnchorEl,
354
+ anchorEl: this.orderColumnsAnchorEl,
347
355
  updateOrderedColumns: onColumnsOrderUpdate,
348
356
  columns: columns,
349
357
  orderedColumns: orderedColumns,
@@ -245,6 +245,12 @@ var HiTopBar = function (_React$Component) {
245
245
  value: function handleClickMenu() {
246
246
  this.props.onClickReturn();
247
247
  }
248
+
249
+ //TODO : Cyclic reference passed.
250
+ /*shouldComponentUpdate(nextProps, nextState){
251
+ return JSON.stringify(this.props) !== JSON.stringify(nextProps);
252
+ }*/
253
+
248
254
  }, {
249
255
  key: 'render',
250
256
  value: function render() {
package/README.md CHANGED
@@ -5,12 +5,14 @@ Voici la documentation du site HiPay Material-UI.
5
5
  Avant de commencer, il faut vous familiariser avec REACT :
6
6
  - https://reactjs.org/
7
7
  - https://reactjs.org/docs/optimizing-performance.html
8
+
8
9
  Et connaitres les [best practices](#best-practices)
9
10
 
10
11
 
11
12
  ## Lancer le projet
12
13
 
13
14
  #### Via docker
15
+
14
16
  Il faut que sur votre poste soit installés
15
17
  - [Docker](https://www.docker.com/community-edition) (minimum version 17)
16
18
  - [Docker Compose](#https://docs.docker.com/compose/install/) (minimum version 1.13.0)
@@ -27,6 +29,7 @@ Le site est dispo à cette URL:
27
29
  [http://localhost:3222](http://localhost:3222)
28
30
 
29
31
  #### En local
32
+
30
33
  Il faut que sur votre poste soit installés
31
34
  - [node](https://nodejs.org/fr/) (minimum version LTS 8.9.4)
32
35
  - [npm](https://www.npmjs.com/) (minimum version 5.6.0)
@@ -115,10 +118,50 @@ git flow feature start PSYCHE-XXX
115
118
  - Les [tests unitaires](#tests) doivent passer
116
119
  - La [génération des apis](#generation-des-apis) aussi
117
120
  - Le code doit être bien formatter : [ESLint - Prettier](#esLint-prettier)
118
- - commit + push
121
+ - Commit - suivant les conventions de rédaction des messages de commit
122
+ - Push
119
123
  - Faire la demande de merge request sur la develop
120
124
  - La revue se fera par un membre de l'équipe PSYCHE
121
125
 
126
+ ##### Conventional Changelog
127
+
128
+ (optionel) installer [commitizen](https://github.com/commitizen/cz-cli) pour s'assurer de commiter selon la convention
129
+ ```sh
130
+ npm install commitizen -g
131
+ ```
132
+
133
+
134
+ Voici un squelette d’exemple de message de commit conventionnel :
135
+ ```
136
+ <type de tâche>(<périmètre>): message court
137
+
138
+ Description complémentaire/complète
139
+
140
+ Référence/action sur un ticket définissant cette tâche
141
+ ```
142
+
143
+ On facilite ainsi la lecture du log d’une part, la génération automatique du changelog (ou release notes) d’autre part
144
+
145
+ Types de tâche:
146
+ - <b>fix</b> : commit d'une correction de bug. Se traduit en <b>PATCH</b> dans le changelog
147
+ - <b>feat</b> : commit d'une nouvelle feature. Se traduit en <b>MINOR</b> dans le changelog
148
+ - <b>test</b> : commit d'un ajout ou d'une maj de tests
149
+ - <b>docs</b> : commit d'un ajout ou d'une maj de la documentation OU de l'app de démonstration
150
+ - <b>perf</b> : commit concernant l'amélioration des performances
151
+
152
+ <b>BREAKING CHANGE</b> : si un commit introduit un BREAKING CHANGE, on doit ajouter le tag BREAKING CHANGE dans le corps du commit. Ce commit peut être de n'importe quel type mais il est préférable qu'il soit lié à une feature. Se traduit en <b>MAJOR</b> dans le changelog
153
+
154
+ Périmètre (optionel): nom du composant, type de tests, page de la doc
155
+
156
+ Exemple:
157
+ ```
158
+ feat(HiTable): add children rows management
159
+
160
+ Handle children rows as subtable based on the same columns as parents.
161
+
162
+ PSYCHE-XX
163
+ ```
164
+
122
165
  ## Génération des apis
123
166
  ```sh
124
167
  npm run docs:api
@@ -178,12 +221,18 @@ Le projet est publié sur un repo privé npm : https://www.npmjs.com/package/@hi
178
221
 
179
222
  #### Publier une nouvelle version
180
223
 
181
- 1. Changer la version dans package.json
182
- 2. Build
224
+ Avoir installé [conventional-changelog-cli](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli) pour générer le CHANGELOG à partir des commits git.
183
225
  ```sh
184
- npm run build
226
+ npm install -g conventional-changelog-cli
227
+ npm install -g cz-conventional-changelog
185
228
  ```
186
- 3. Publish
229
+
230
+ 1. Changer la version dans package.json
231
+ 2. Générer le fichier HI-CHANGELOG.md : ```npm run changelog```
232
+ 3. Commiter la release : ```git ci -am "chore(release): VERSION DATE```
233
+ 4. Build : ```npm run build```
234
+ 5. Publish :
235
+
187
236
  ```sh
188
237
  cd build
189
238
  npm login
@@ -192,7 +241,24 @@ npm login
192
241
  npm publish
193
242
  ```
194
243
 
195
- # Si ERR d'authenitifcation
244
+ #### [Semantic Versioning](https://semver.org/)
245
+
246
+ Une version MAJOR.MINOR.PATCH, correspond a:
247
+
248
+ - MAJOR version introduisant des évolutions non retro-compatibles (API changes...),
249
+ - MINOR version introduisant des évolutions retro-compatibles, la sortie des versions mineures est basé sur les sprints de la tribu PSYCHE
250
+ - PATCH version corrigeant des bugs
251
+ Des tags additionels peuvent être ajouter selon le contexte (ex: 1.0.0-beta.24).
252
+
253
+ En production, chaque releases (MAJOR, MINOR & PATCH) doit faire l'objet d'une communication interne aux tribus utilisatrices.
254
+
255
+ Les projets peuvent se baser sur une version MINOR: ```^2.5.0```, ce qui signifient "compatible avec la version 2.5.0".
256
+
257
+ Ainsi les PATCH seront automatiquement pris en compte.
258
+ L'intégration d'une MINOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md).
259
+ Le passage à une autre MAJOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md BREAKING CHANGE).
260
+
261
+ # Si ERR d'authentification
196
262
  npm adduser
197
263
  admin
198
264
  admin123
@@ -27,14 +27,24 @@ export const styles = theme => ({
27
27
  },
28
28
  '&$deletable': {
29
29
  paddingRight: 4
30
+ },
31
+ '&$leftIccon': {
32
+ paddingLeft: 4
30
33
  }
31
34
  }),
32
35
  leftNavigation: {},
33
36
  rightNavigation: {},
34
37
  deletable: {},
38
+ leftIccon: {},
35
39
  icon: {
36
40
  marginRight: 4
37
41
  },
42
+ iconClickable: {
43
+ cursor: 'pointer',
44
+ '&:hover, &:focus': {
45
+ color: theme.palette.business.primary.normal
46
+ }
47
+ },
38
48
  eraseIcon: {
39
49
  // Remove grey highlight
40
50
  WebkitTapHighlightColor: 'transparent',
@@ -78,7 +88,24 @@ export const styles = theme => ({
78
88
  });
79
89
 
80
90
  function HiChip(props) {
81
- const { label, classes, icon, id, img, onPrevious, onNext, onDelete, prefix } = props;
91
+ const {
92
+ label,
93
+ classes,
94
+ icon,
95
+ id,
96
+ img,
97
+ onPrevious,
98
+ onNext,
99
+ onDelete,
100
+ prefix,
101
+ onIconClick,
102
+ title,
103
+ titleDelete,
104
+ titleIcon,
105
+ titleImg,
106
+ titleNext,
107
+ titlePrevious
108
+ } = props;
82
109
 
83
110
  return React.createElement(
84
111
  'div',
@@ -87,8 +114,10 @@ function HiChip(props) {
87
114
  className: classNames(classes.root, {
88
115
  [classes.leftNavigation]: onPrevious,
89
116
  [classes.rightNavigation]: onNext,
90
- [classes.deletable]: onDelete
91
- })
117
+ [classes.deletable]: onDelete,
118
+ [classes.leftIccon]: icon
119
+ }),
120
+ title: title
92
121
  },
93
122
  prefix && React.createElement(
94
123
  'span',
@@ -96,13 +125,22 @@ function HiChip(props) {
96
125
  prefix,
97
126
  ' : '
98
127
  ),
99
- img && React.createElement('img', { className: classes.badge, src: img, alt: img }),
100
- icon && React.createElement(HiIconBuilder, { className: classes.icon, icon: icon, size: 16 }),
128
+ img && React.createElement('img', { className: classes.badge, src: img, alt: img, title: titleImg }),
129
+ icon && React.createElement(HiIconBuilder, {
130
+ className: classNames(classes.icon, {
131
+ [classes.iconClickable]: onIconClick
132
+ }),
133
+ icon: icon,
134
+ size: 16,
135
+ onClick: onIconClick,
136
+ title: titleIcon
137
+ }),
101
138
  onPrevious && React.createElement(HiIconBuilder, {
102
139
  className: classNames(classes.navigate),
103
140
  icon: 'menuLeft',
104
141
  onClick: onPrevious,
105
- size: 16
142
+ size: 16,
143
+ title: titlePrevious
106
144
  }),
107
145
  React.createElement(
108
146
  'span',
@@ -113,13 +151,15 @@ function HiChip(props) {
113
151
  className: classNames(classes.navigate),
114
152
  icon: 'menuRight',
115
153
  onClick: onNext,
116
- size: 16
154
+ size: 16,
155
+ title: titleNext
117
156
  }),
118
157
  onDelete && React.createElement(HiIconBuilder, {
119
158
  classes: { root: classes.eraseIcon },
120
159
  icon: 'closeCircle',
121
160
  onClick: onDelete,
122
- size: 16
161
+ size: 16,
162
+ title: titleDelete
123
163
  })
124
164
  );
125
165
  }
@@ -149,6 +189,10 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
149
189
  * Fonction de callback au clic sur l'icon close si cancelable = true
150
190
  */
151
191
  onDelete: PropTypes.func,
192
+ /**
193
+ * Fonction de callback au clic sur l'icon à gauche
194
+ */
195
+ onIconClick: PropTypes.func,
152
196
  /**
153
197
  * Fonction de callback au clic sur l'icon next
154
198
  */
@@ -156,7 +200,35 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
156
200
  /**
157
201
  * Fonction de callback au clic sur l'icon previous
158
202
  */
159
- onPrevious: PropTypes.func
203
+ onPrevious: PropTypes.func,
204
+ /**
205
+ * Préfixe dans le HiChip
206
+ */
207
+ prefix: PropTypes.string,
208
+ /**
209
+ * Titre du chip
210
+ */
211
+ title: PropTypes.string,
212
+ /**
213
+ * Titre de l'icône supprimer
214
+ */
215
+ titleDelete: PropTypes.string,
216
+ /**
217
+ * Titre de l'icône
218
+ */
219
+ titleIcon: PropTypes.string,
220
+ /**
221
+ * Titre de la balise img
222
+ */
223
+ titleImg: PropTypes.string,
224
+ /**
225
+ * Titre de la navigation suivante
226
+ */
227
+ titleNext: PropTypes.string,
228
+ /**
229
+ * Titre de la navigation précédente
230
+ */
231
+ titlePrevious: PropTypes.string
160
232
  } : {};
161
233
 
162
234
  export default withStyles(styles, { name: 'HmuiHiChip' })(HiChip);
@@ -27,6 +27,7 @@ class HiDateRangePicker extends React.Component {
27
27
  super();
28
28
 
29
29
  this.handleInputChange = inputName => event => {
30
+ this.event = event;
30
31
  this.props.onChange(inputName, event.target.value);
31
32
  };
32
33
 
@@ -34,6 +35,13 @@ class HiDateRangePicker extends React.Component {
34
35
  this.setState({ focusedInput: name });
35
36
  };
36
37
 
38
+ this.handleDayPickerBlur = name => () => {
39
+ this.setState({ focusedInput: '' });
40
+ if (this.props.onBlur) {
41
+ this.props.onBlur(name);
42
+ }
43
+ };
44
+
37
45
  this.state = {
38
46
  fromCurrentMonth: props.from ? props.from : new Date(),
39
47
  toCurrentMonth: props.to ? props.to : new Date(),
@@ -100,11 +108,7 @@ class HiDateRangePicker extends React.Component {
100
108
  }
101
109
 
102
110
  handleReset(name) {
103
- if (name === 'from') {
104
- this.handleCurrentMonthChange(name, new Date());
105
- } else {
106
- this.handleCurrentMonthChange(name, this.props.from);
107
- }
111
+ this.handleCurrentMonthChange(name, new Date());
108
112
 
109
113
  this.timeout = setTimeout(() => {
110
114
  if (this.props.onReset) {
@@ -122,7 +126,12 @@ class HiDateRangePicker extends React.Component {
122
126
  if (name === 'from' && this.toInput) {
123
127
  this.toInput.getInput().focus();
124
128
  } else if (name === 'to') {
125
- document.activeElement.blur();
129
+ if (typeof this.event === 'undefined' || this.event && this.event.type !== 'change') {
130
+ // trigger blur only if user clicks on date into calendar
131
+ // else keep focus to see day selection into calendar
132
+ document.activeElement.blur();
133
+ }
134
+ delete this.event;
126
135
  }
127
136
  }
128
137
  } else {
@@ -222,10 +231,6 @@ class HiDateRangePicker extends React.Component {
222
231
  }
223
232
  }
224
233
 
225
- handleDayPickerBlur() {
226
- this.setState({ focusedInput: '' });
227
- }
228
-
229
234
  openPanel(name, panel) {
230
235
  this.setState({
231
236
  [`${name}OpenedPanel`]: panel
@@ -479,7 +484,7 @@ class HiDateRangePicker extends React.Component {
479
484
  {
480
485
  className: classes.fromInput,
481
486
  onFocus: this.handleDayPickerFocus('from'),
482
- onBlur: this.handleDayPickerBlur
487
+ onBlur: this.handleDayPickerBlur('from')
483
488
  },
484
489
  React.createElement(
485
490
  'div',
@@ -507,7 +512,7 @@ class HiDateRangePicker extends React.Component {
507
512
  {
508
513
  className: toClass,
509
514
  onFocus: this.handleDayPickerFocus('to'),
510
- onBlur: this.handleDayPickerBlur
515
+ onBlur: this.handleDayPickerBlur('to')
511
516
  },
512
517
  React.createElement(DayPickerInput, {
513
518
  ref: el => {
@@ -604,10 +609,18 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
604
609
  minimumDate: PropTypes.instanceOf(Date),
605
610
  /**
606
611
  * Callback à la sélection d'une date
612
+ * @param {string} nom de l'input
613
+ */
614
+ onBlur: PropTypes.func,
615
+ /**
616
+ * Callback à la sélection d'une date
617
+ * @param {string} nom du champs
618
+ * @param {string} nouvelle valeur du champs
607
619
  */
608
620
  onChange: PropTypes.func,
609
621
  /**
610
622
  * Callback au reset de l'input
623
+ * @param {string} nom du champs réinitialisé
611
624
  */
612
625
  onReset: PropTypes.func,
613
626
  /**
@@ -42,13 +42,13 @@ export function buildDateRangeOptionByKey(key, t, format) {
42
42
  label = t.current_week;
43
43
  from = moment().startOf('week');
44
44
  to = moment();
45
- info = `${t.week} ${from.format('w')}, \n ${from.format(format)} ${t.to_now}`;
45
+ info = `${t.short_week}${from.format('w')}, \n ${from.format(format)} ${t.to_now}`;
46
46
  break;
47
47
  case 'pw':
48
48
  label = t.previous_week;
49
49
  from = moment().subtract(1, 'week').startOf('week');
50
50
  to = moment().subtract(1, 'week').endOf('week');
51
- info = `${t.week} ${from.format('w')}, ${from.format(format)} ${t.to} ${to.format(format)}`;
51
+ info = `${t.short_week}${from.format('w')}, ${from.format(format)} ${t.to} ${to.format(format)}`;
52
52
  break;
53
53
  case 'cm':
54
54
  label = t.current_month;
@@ -146,6 +146,15 @@ class HiDateRangeSelector extends React.Component {
146
146
  this.options = props.availableOptionKeys.map(key => buildDateRangeOptionByKey(key, props.translations, props.format));
147
147
  }
148
148
 
149
+ static getDerivedStateFromProps(props, state) {
150
+ if (props.defaultPreset && props.returnSelectValue) {
151
+ return {
152
+ selectedPreset: props.defaultPreset
153
+ };
154
+ }
155
+ return null;
156
+ }
157
+
149
158
  componentDidMount() {
150
159
  if (this.container) {
151
160
  this.setState({ containerWidth: findDOMNode(this.container).clientWidth });
@@ -250,6 +259,7 @@ HiDateRangeSelector.defaultProps = {
250
259
  month: 'Month',
251
260
  quarter: 'Quarter',
252
261
  week: 'Week',
262
+ short_week: 'W',
253
263
  year: 'Year',
254
264
  days: 'days',
255
265
  custom_period: 'Custom Period',
@@ -153,6 +153,7 @@ class HiInput extends React.PureComponent {
153
153
  if (this.props.onReset) {
154
154
  this.props.onReset();
155
155
  }
156
+ this.inputElement.focus();
156
157
  }
157
158
 
158
159
  handleBlur(event) {
@@ -11,9 +11,9 @@ import HiTextField from './HiTextField';
11
11
  export const styles = theme => ({
12
12
  inputPassword: {
13
13
  fontWeight: 'bolder',
14
- fontFamily: 'Verdana, sans-serif',
14
+ fontFamily: 'inherit',
15
15
  letterSpacing: '4px',
16
- fontSize: 25
16
+ fontSize: '1.6rem'
17
17
  }
18
18
  });
19
19
 
@@ -10,7 +10,7 @@ export const styles = theme => ({
10
10
  display: 'inline-block',
11
11
  padding: '0 9px',
12
12
  height: 16,
13
- lineHeight: '16px',
13
+ lineHeight: '18px',
14
14
  minWidth: 25,
15
15
  textAlign: 'center',
16
16
  borderRadius: '45px',
@@ -33,9 +33,9 @@ export const styles = theme => ({
33
33
  *
34
34
  */
35
35
  function HiPins(props) {
36
- const { classes, children, color, onClick, className } = props;
36
+ const { classes, theme, children, color = props.theme.palette.business.primary.normal, onClick, className } = props;
37
37
 
38
- const textColor = getContrastedTextColor(color, props.theme.palette.neutral.dark, '#FFF');
38
+ const textColor = getContrastedTextColor(color, theme.palette.neutral.dark, '#FFF');
39
39
 
40
40
  const divProps = {
41
41
  style: { backgroundColor: color, color: textColor }
@@ -59,7 +59,7 @@ HiPins.propTypes = process.env.NODE_ENV !== "production" ? {
59
59
  children: PropTypes.node.isRequired,
60
60
  classes: PropTypes.object.isRequired,
61
61
  className: PropTypes.string,
62
- color: PropTypes.string.isRequired,
62
+ color: PropTypes.string,
63
63
  onClick: PropTypes.func
64
64
  } : {};
65
65
  export default withStyles(styles, { withTheme: true, name: 'HmuiHiPins' })(HiPins);
@@ -78,7 +78,7 @@ class HiSelect extends React.PureComponent {
78
78
  hierarchySelected: {},
79
79
  hierarchy: {},
80
80
  nbOptions: 0,
81
- dynamic: false
81
+ dynamic: props.dynamic || false
82
82
  };
83
83
 
84
84
  // Check if value is in options
@@ -121,7 +121,7 @@ class HiSelect extends React.PureComponent {
121
121
  }
122
122
  });
123
123
  this.state.nbOptions = optionsLength;
124
- } else {
124
+ } else if (!props.dynamic) {
125
125
  this.state.dynamic = true;
126
126
  }
127
127
 
@@ -223,10 +223,11 @@ class HiSelect extends React.PureComponent {
223
223
  id,
224
224
  placeholder,
225
225
  staticPosition,
226
- pinnedItem
226
+ pinnedItem,
227
+ hasAll
227
228
  } = this.props;
228
229
 
229
- const { open, suggestions, focused } = this.state;
230
+ const { open, suggestions, focused, dynamic } = this.state;
230
231
 
231
232
  let display = '';
232
233
  const selectedIdList = Array.isArray(value) ? value : value ? [value] : [];
@@ -249,26 +250,27 @@ class HiSelect extends React.PureComponent {
249
250
  });
250
251
  }
251
252
 
252
- if (this.state.dynamic && selectedIdList.length === 1) {
253
- display = translations.one_item_selected.replace('%s', selectedIdList.length);
254
- } else if (this.state.nbOptions !== selectedIdList.length && selectedIdList.length > 1) {
253
+ if ((dynamic || loading) && selectedIdList.length === 1) {
254
+ display = translations.one_item_selected;
255
+ } else if ((this.state.nbOptions !== selectedIdList.length || !hasAll) && selectedIdList.length > 1) {
255
256
  display = translations.n_items_selected.replace('%s', selectedIdList.length);
256
- } else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions >= 1) {
257
+ } else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions > 1) {
257
258
  display = translations.all;
258
259
  } else if (selectedIdList.length === 1) {
259
- if (type !== 'icon') {
260
- let item = options.find(o => o.id === selectedIdList[0]);
261
- if (!item && pinnedItem) {
260
+ let item = options.find(o => o.id === selectedIdList[0]);
261
+ if (item === undefined) {
262
+ display = translations.one_item_selected;
263
+ } else if (type !== 'icon') {
264
+ if (pinnedItem) {
262
265
  item = pinnedItem;
263
266
  }
264
267
  display = item.label;
265
268
  } else {
266
- const optionSelected = options.find(o => o.id === selectedIdList[0]);
267
269
  display = React.createElement(
268
270
  'span',
269
271
  { className: classes.selectIconLabel },
270
- React.createElement(HiIconBuilder, { icon: optionSelected.icon, className: classes.labelIcon }),
271
- optionSelected.label
272
+ React.createElement(HiIconBuilder, { icon: item.icon, className: classes.labelIcon }),
273
+ item.label
272
274
  );
273
275
  }
274
276
  }
@@ -402,6 +404,7 @@ HiSelect.defaultProps = {
402
404
  hierarchic: false,
403
405
  parentItemSelectable: false,
404
406
  displayAsChip: false,
407
+ dynamic: false,
405
408
  icon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
406
409
  parentIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
407
410
  hoverIcon: React.createElement(CheckboxBlankOutline, { style: { width: 20, height: 20 } }),
@@ -632,9 +635,9 @@ var _initialiseProps = function () {
632
635
  }
633
636
  }
634
637
  this.setState({ hierarchySelected: hiSelected });
635
- onChange(event, valueList);
638
+ onChange(event, valueList, item);
636
639
  } else {
637
- onChange(event, item.id);
640
+ onChange(event, item.id, item);
638
641
  this.handleClose();
639
642
  }
640
643
  };
@@ -701,6 +704,12 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
701
704
  * Option permettant d'afficher les sélection sous forme de Chip.
702
705
  */
703
706
  displayAsChip: PropTypes.bool,
707
+ /**
708
+ * Option permettant de définir si les options du select sont dynamiques.
709
+ * Si les options du select sont initialisées à vide, alors ce sera mis à true
710
+ * automatiquement.
711
+ */
712
+ dynamic: PropTypes.bool.isRequired,
704
713
  /**
705
714
  * Applique le style error
706
715
  */