@hipay/hipay-material-ui 2.0.0-beta.65 → 2.0.0-beta.68

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,78 @@
1
+ # [2.0.0-beta.64](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.64) (2019-03-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
7
+ * **HiAlertModal:** Correct styles and buttons positions ([2cfa2a9](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2cfa2a9))
8
+ * **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
9
+ * **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
10
+ * **HiDynamicSelect:** remove onSelect override ([b803044](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b803044))
11
+ * **HiExpansionPanel:** fix props propagation collapseDisable || expanded ([eb18a96](https://gitlab.hipay.org/backend/hipay-material-ui/commit/eb18a96))
12
+ * **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
13
+ * **HiInput:** forward event in onClick ([be94fe0](https://gitlab.hipay.org/backend/hipay-material-ui/commit/be94fe0))
14
+ * **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
15
+ * **HiInput:** rename prop to spellCheck ([c11939f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c11939f))
16
+ * **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
17
+ * **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
18
+ * **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
19
+ * **HiSelect:** Forward event in onBlur ([76c6778](https://gitlab.hipay.org/backend/hipay-material-ui/commit/76c6778))
20
+ * **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
21
+ * **HiSelect:** remove HiSelectNew calls ([cc5397d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cc5397d))
22
+ * **HiSelectableList:** Add lazy props to activate lazyloading (default true) and fix unit tests ([b41f8d2](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b41f8d2))
23
+ * **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
24
+ * **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
25
+ * **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
26
+ * **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
27
+ * **HiTable:** Fix test ([9a009a8](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a009a8))
28
+ * **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
29
+ * **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
30
+ * **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
31
+
32
+
33
+ ### Code Refactoring
34
+
35
+ * deleting the old HiSelect and replacing it by the new (PSYCHE-1382) ([d5fc252](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d5fc252))
36
+
37
+
38
+ ### Features
39
+
40
+ * **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
41
+ * **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
42
+ * **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
43
+ * **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
44
+ * **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
45
+ * **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
46
+ * **HiDatePicke:** add timezone props ([18360a5](https://gitlab.hipay.org/backend/hipay-material-ui/commit/18360a5))
47
+ * **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
48
+ * **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
49
+ * **HiInput:** add spellcheck property ([b2feac3](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b2feac3))
50
+ * **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
51
+ * **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
52
+ * **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
53
+ * **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
54
+ * **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
55
+ * **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
56
+ * **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
57
+ * **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
58
+
59
+
60
+ ### Performance Improvements
61
+
62
+ * **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
63
+
64
+
65
+ ### BREAKING CHANGES
66
+
67
+ * HiSelectNew no longer exist, make sure you're importing HiSelect instead
68
+ * **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
69
+ * **HiUploadField:** Components names changes
70
+ * **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
71
+ CellImage & CellText)
72
+ * **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
73
+
74
+
75
+
1
76
  # [2.0.0-beta.63](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.63) (2019-02-15)
2
77
 
3
78
 
@@ -43,25 +43,27 @@ var _HiButton = _interopRequireDefault(require("../HiButton"));
43
43
 
44
44
  var _HiIcon = _interopRequireDefault(require("../HiIcon"));
45
45
 
46
+ var _helpers = require("../utils/helpers");
47
+
46
48
  // @inheritedComponent Dialog
47
49
  var styles = function styles(theme) {
48
50
  return {
49
51
  classContent: {
50
52
  fontSize: 14,
51
- lineHeight: '20px',
53
+ lineHeight: '24px',
52
54
  color: '#484848',
53
55
  position: 'relative'
54
56
  },
55
57
  classDialogPaper: {
56
- minHeight: 280,
58
+ minHeight: 248,
57
59
  maxWidth: 280,
58
60
  borderRadius: 2
59
61
  },
60
62
  classCancelButton: {
61
- float: 'right'
63
+ margin: '0'
62
64
  },
63
65
  classSubmitButton: {
64
- margin: '0'
66
+ float: 'right'
65
67
  },
66
68
  classTitle: {
67
69
  fontSize: 20,
@@ -105,18 +107,6 @@ function (_React$PureComponent) {
105
107
  (0, _classCallCheck2.default)(this, HiAlertModal);
106
108
  _this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiAlertModal).call(this, props));
107
109
 
108
- _this.handleClickCancel = function () {
109
- if (_this.props.onCancelClick) {
110
- _this.props.onCancelClick();
111
- }
112
- };
113
-
114
- _this.handleClickSubmit = function () {
115
- if (_this.props.onSubmitClick) {
116
- _this.props.onSubmitClick();
117
- }
118
- };
119
-
120
110
  _this.handleOnClose = function () {
121
111
  if (_this.props.onClose) {
122
112
  _this.props.onClose();
@@ -124,10 +114,8 @@ function (_React$PureComponent) {
124
114
  };
125
115
 
126
116
  _this.handleOnClose = _this.handleOnClose.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
127
- _this.handleClickCancel = _this.handleClickCancel.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
128
- _this.handleClickSubmit = _this.handleClickSubmit.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
129
117
  return _this;
130
- } // Appelé au clic du bouton d'annulation
118
+ } // Appelé si clic en dehors de la pop up
131
119
 
132
120
 
133
121
  (0, _createClass2.default)(HiAlertModal, [{
@@ -148,6 +136,17 @@ function (_React$PureComponent) {
148
136
  submitColor = _this$props.submitColor,
149
137
  title = _this$props.title,
150
138
  props = (0, _objectWithoutProperties2.default)(_this$props, ["backgroundIcon", "iconSize", "classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "cancelColor", "submitColor", "title"]);
139
+ var dialogContent = content;
140
+
141
+ if (typeof content === 'string') {
142
+ dialogContent = _react.default.createElement("span", {
143
+ // eslint-disable-next-line react/no-danger
144
+ dangerouslySetInnerHTML: {
145
+ __html: (0, _helpers.escapeHTML)(content)
146
+ }
147
+ });
148
+ }
149
+
151
150
  return _react.default.createElement(_Dialog.default, (0, _extends2.default)({
152
151
  open: open,
153
152
  onClose: this.handleOnClose,
@@ -169,29 +168,30 @@ function (_React$PureComponent) {
169
168
  classes: {
170
169
  root: classes.classContent
171
170
  }
172
- }, content)), _react.default.createElement(_DialogActions.default, {
171
+ }, dialogContent)), _react.default.createElement(_DialogActions.default, {
173
172
  classes: {
174
173
  root: classes.classAction
175
174
  }
176
- }, labelSubmitButton && _react.default.createElement(_HiButton.default, {
177
- classes: {
178
- root: classes.classSubmitButton
179
- },
180
- onClick: this.handleClickSubmit,
181
- color: submitColor
182
- }, labelSubmitButton), labelCancelButton && _react.default.createElement(_HiButton.default, {
175
+ }, labelCancelButton && _react.default.createElement(_HiButton.default, {
183
176
  classes: {
184
177
  root: classes.classCancelButton
185
178
  },
186
- onClick: this.handleClickCancel,
179
+ onClick: onCancelClick,
187
180
  color: cancelColor
188
- }, labelCancelButton)));
181
+ }, labelCancelButton), labelSubmitButton && _react.default.createElement(_HiButton.default, {
182
+ classes: {
183
+ root: classes.classSubmitButton
184
+ },
185
+ onClick: onSubmitClick,
186
+ color: submitColor
187
+ }, labelSubmitButton)));
189
188
  }
190
189
  }]);
191
190
  return HiAlertModal;
192
191
  }(_react.default.PureComponent);
193
192
 
194
193
  HiAlertModal.defaultProps = {
194
+ content: '',
195
195
  cancelColor: 'neutral',
196
196
  submitColor: 'primary'
197
197
  };
@@ -72,16 +72,17 @@ function (_React$PureComponent) {
72
72
  }, _react.default.createElement("div", null, steps.map(function (step, index) {
73
73
  var validConnector = step.status === 'validated' && index < steps.length - 1 && (steps[index + 1].status === 'validated' || steps[index + 1].status === 'active');
74
74
  return _react.default.createElement(_HiStep.default, {
75
- index: index,
75
+ index: step.id,
76
76
  content: step.content,
77
77
  key: step.id,
78
- onClick: _this2.handleStep(index),
78
+ onClick: _this2.handleStep(step.id),
79
79
  isLast: index === steps.length - 1,
80
80
  validConnector: validConnector,
81
81
  type: type,
82
- steps: steps
82
+ steps: steps,
83
+ active: activeStep === step.id
83
84
  }, _react.default.createElement(_HiStepLabel.default, {
84
- active: activeStep === index,
85
+ active: activeStep === step.id,
85
86
  status: step.status,
86
87
  notificationNumber: step.notificationNumber,
87
88
  type: type,
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = exports.styles = void 0;
9
9
 
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
10
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
13
 
12
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -35,17 +37,31 @@ var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"
35
37
 
36
38
  var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
37
39
 
40
+ var _classnames = _interopRequireDefault(require("classnames"));
41
+
38
42
  // @inheritedComponent ExpansionPanel
39
43
  var styles = function styles(theme) {
40
44
  return {
41
45
  summaryContent: {
42
46
  display: 'inline-block',
43
- border: 'none'
47
+ border: 'none',
48
+ '&$expanded': {
49
+ margin: 'initial'
50
+ }
44
51
  },
45
52
  summaryRoot: {
46
53
  borderBottom: '1px solid #E3E6E7',
47
54
  height: 48,
48
- minHeight: 48
55
+ minHeight: 48,
56
+ padding: '0 0 0 8px',
57
+ '&$expanded': {
58
+ minHeight: 48
59
+ }
60
+ },
61
+ expanded: {},
62
+ collapseDisable: {
63
+ cursor: 'default',
64
+ pointerEvents: 'none'
49
65
  },
50
66
  heading: (0, _extends2.default)({}, theme.typography.b1, {
51
67
  fontSize: 20,
@@ -57,7 +73,7 @@ var styles = function styles(theme) {
57
73
  fontSize: 11,
58
74
  lineHeight: '24px',
59
75
  float: 'right',
60
- marginRight: 40,
76
+ marginRight: 32,
61
77
  '&>svg': {
62
78
  fontSize: 18,
63
79
  marginLeft: 3,
@@ -69,11 +85,16 @@ var styles = function styles(theme) {
69
85
  border: 'none'
70
86
  },
71
87
  panelDetails: {
72
- padding: '8px 24px'
88
+ padding: 0
73
89
  },
74
90
  disabledPanel: {
75
91
  backgroundColor: '#ffffff',
76
92
  opacity: 1
93
+ },
94
+ expandIcon: {
95
+ width: 24,
96
+ height: 24,
97
+ right: 0
77
98
  }
78
99
  };
79
100
  };
@@ -101,22 +122,28 @@ function (_React$PureComponent) {
101
122
  secondaryHeading = _this$props.secondaryHeading,
102
123
  secondaryHeadingDisabled = _this$props.secondaryHeadingDisabled,
103
124
  secondaryHeadingIcon = _this$props.secondaryHeadingIcon,
125
+ collapseDisable = _this$props.collapseDisable,
104
126
  children = _this$props.children,
105
127
  classes = _this$props.classes,
106
- props = (0, _objectWithoutProperties2.default)(_this$props, ["disabled", "heading", "secondaryHeading", "secondaryHeadingDisabled", "secondaryHeadingIcon", "children", "classes"]);
128
+ expanded = _this$props.expanded,
129
+ props = (0, _objectWithoutProperties2.default)(_this$props, ["disabled", "heading", "secondaryHeading", "secondaryHeadingDisabled", "secondaryHeadingIcon", "collapseDisable", "children", "classes", "expanded"]);
107
130
  var effectiveDisabled = disabled || !children;
108
131
  return _react.default.createElement(_ExpansionPanel.default, (0, _extends2.default)({
109
132
  disabled: effectiveDisabled,
110
133
  classes: {
111
134
  root: classes.panel,
112
135
  disabled: classes.disabledPanel
113
- }
136
+ },
137
+ expanded: collapseDisable || expanded
114
138
  }, props), _react.default.createElement(_ExpansionPanelSummary.default, {
115
139
  classes: {
116
140
  root: classes.summaryRoot,
117
- content: classes.summaryContent
141
+ content: classes.summaryContent,
142
+ expanded: classes.expanded,
143
+ expandIcon: classes.expandIcon
118
144
  },
119
- expandIcon: _ref
145
+ className: (0, _classnames.default)((0, _defineProperty2.default)({}, classes.collapseDisable, collapseDisable)),
146
+ expandIcon: !collapseDisable && _ref
120
147
  }, _react.default.createElement("div", {
121
148
  className: classes.secondaryHeading
122
149
  }, !effectiveDisabled ? secondaryHeading : secondaryHeadingDisabled, secondaryHeadingIcon), _react.default.createElement("div", {
@@ -169,7 +196,12 @@ HiExpansionPanel.propTypes = process.env.NODE_ENV !== "production" ? {
169
196
  /**
170
197
  * Icone dans le titre secondaire du panel
171
198
  */
172
- secondaryHeadingIcon: _propTypes.default.any
199
+ secondaryHeadingIcon: _propTypes.default.any,
200
+
201
+ /**
202
+ * Désactive l'action d'ouverture et de fermeture du composant
203
+ */
204
+ collapseDisable: _propTypes.default.bool
173
205
  } : {};
174
206
 
175
207
  var _default = (0, _withStyles.default)(styles, {
@@ -408,9 +408,9 @@ HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
408
408
  helperText: _propTypes.default.string,
409
409
 
410
410
  /**
411
- * id du composant
411
+ * Identifiant unique
412
412
  */
413
- id: _propTypes.default.string.isRequired,
413
+ id: _propTypes.default.string,
414
414
 
415
415
  /**
416
416
  * Array containing each of the inputs the component has to show (represented by an object).
@@ -271,6 +271,12 @@ function (_React$PureComponent) {
271
271
  if (!_this.props.searchable) {
272
272
  // Sinon focus sur l'élément sélectionné
273
273
  _this.focusOnSelectedItem(_this.props.value);
274
+ } else {
275
+ if (_this.searchField) {
276
+ setTimeout(function () {
277
+ _this.searchField.focus();
278
+ }, 1);
279
+ }
274
280
  }
275
281
  }
276
282
  };
@@ -350,7 +356,7 @@ function (_React$PureComponent) {
350
356
  _this.handleClose();
351
357
  }
352
358
  }
353
- } else if (key === 'space') {
359
+ } else if (key === 'space' && event.target !== _this.searchField) {
354
360
  event.preventDefault();
355
361
 
356
362
  if (_this.state.open) {
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -35,6 +37,8 @@ var _helpers = require("../utils/helpers");
35
37
 
36
38
  var _keycode = _interopRequireDefault(require("keycode"));
37
39
 
40
+ var _reactLazyload = _interopRequireWildcard(require("react-lazyload"));
41
+
38
42
  var styles = function styles() {
39
43
  return {
40
44
  root: {
@@ -101,17 +105,35 @@ function (_React$PureComponent) {
101
105
  hideCheckbox = _this$props.hideCheckbox,
102
106
  hoverIcon = _this$props.hoverIcon,
103
107
  icon = _this$props.icon,
108
+ lazy = _this$props.lazy,
104
109
  selectedItemIdList = _this$props.selectedItemIdList,
105
110
  sort = _this$props.sort,
106
111
  onKeyDown = _this$props.onKeyDown,
107
112
  onKeyUp = _this$props.onKeyUp,
108
- others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
113
+ others = (0, _objectWithoutProperties2.default)(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
109
114
 
110
115
  if (sort && item.children) {
111
116
  item.children.sort(_this.compareItem);
112
117
  }
113
118
 
114
- return _react.default.createElement(_react.default.Fragment, {
119
+ var placeholderContent = _react.default.createElement("div", {
120
+ style: {
121
+ width: '90%',
122
+ padding: '8px 6px',
123
+ height: 40,
124
+ position: 'sticky',
125
+ left: 0
126
+ }
127
+ }, _react.default.createElement("div", {
128
+ style: {
129
+ backgroundColor: '#F5F5F5',
130
+ width: '100%',
131
+ height: '100%',
132
+ borderRadius: 4
133
+ }
134
+ }));
135
+
136
+ var itemComponent = _react.default.createElement(_react.default.Fragment, {
115
137
  key: item.id
116
138
  }, _react.default.createElement(_HiSelectableListItem.default, (0, _extends2.default)({}, others, {
117
139
  checkedIcon: checkedIcon,
@@ -131,6 +153,19 @@ function (_React$PureComponent) {
131
153
  }).map(function (subItem) {
132
154
  return _this.buildRecursiveListItem(subItem, level + 1);
133
155
  }));
156
+
157
+ if (lazy) {
158
+ return _react.default.createElement(_reactLazyload.default, {
159
+ key: item.id,
160
+ height: 40,
161
+ offset: 400,
162
+ once: true,
163
+ overflow: true,
164
+ placeholder: placeholderContent
165
+ }, itemComponent);
166
+ } else {
167
+ return itemComponent;
168
+ }
134
169
  };
135
170
 
136
171
  _this.compareItem = function (a, b) {
@@ -165,9 +200,8 @@ function (_React$PureComponent) {
165
200
 
166
201
  // Focus on last item selected
167
202
  if (this.props.overlay && this.props.overlay.getElementsByTagName('li')[0]) {
168
- var item = this.props.overlay.getElementsByTagName('li')[0];
169
-
170
- if (this.props.value) {
203
+ if (Array.isArray(this.props.value) && this.props.value.length > 0 || !Array.isArray(this.props.value) && this.props.value) {
204
+ var item = this.props.overlay.getElementsByTagName('li')[0];
171
205
  var lastSelectedValue = Array.isArray(this.props.value) ? this.props.value[this.props.value.length - 1] : this.props.value;
172
206
  var index = 0;
173
207
  this.props.itemList.forEach(function (option) {
@@ -187,9 +221,15 @@ function (_React$PureComponent) {
187
221
  });
188
222
  }
189
223
  });
224
+ item && item.focus();
190
225
  }
191
-
192
- item.focus();
226
+ }
227
+ }
228
+ }, {
229
+ key: "componentDidUpdate",
230
+ value: function componentDidUpdate(prevProps) {
231
+ if (this.props.lazy && prevProps.itemList !== this.props.itemList) {
232
+ (0, _reactLazyload.forceCheck)();
193
233
  }
194
234
  }
195
235
  }, {
@@ -228,6 +268,7 @@ HiSelectableList.defaultProps = {
228
268
  disabled: false,
229
269
  disabledItemIdList: [],
230
270
  hideCheckbox: false,
271
+ lazy: true,
231
272
  selectedItemIdList: [],
232
273
  sort: false,
233
274
  sortAppendList: ['_all']
@@ -283,6 +324,11 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
283
324
  */
284
325
  itemList: _propTypes.default.array.isRequired,
285
326
 
327
+ /**
328
+ * Active lazyloading on list items
329
+ */
330
+ lazy: _propTypes.default.bool,
331
+
286
332
  /**
287
333
  * Fonction de callback à la sélection d'un item, renvoie l'item sélectionné
288
334
  *
@@ -53,7 +53,7 @@ var styles = function styles(theme) {
53
53
  backgroundColor: "".concat(theme.palette.action.hover, " !important")
54
54
  }
55
55
  },
56
- clicableRow: {
56
+ clickableRow: {
57
57
  cursor: 'pointer'
58
58
  }
59
59
  };
@@ -95,7 +95,7 @@ function (_React$PureComponent) {
95
95
  locale = _this$props.locale,
96
96
  rowdata = _this$props.rowdata;
97
97
  return _react.default.createElement(_TableRow.default, {
98
- className: (0, _classnames.default)(classes.row, (0, _defineProperty2.default)({}, classes.clicableRow, this.props.onClick)),
98
+ className: (0, _classnames.default)(classes.row, (0, _defineProperty2.default)({}, classes.clickableRow, this.props.onClick)),
99
99
  hover: true,
100
100
  onClick: function onClick(event) {
101
101
  return _this2.handleClick(event, rowdata);
package/README.md CHANGED
@@ -189,7 +189,7 @@ npm run test:unit
189
189
 
190
190
  ##### Jouer les tests sur un seul composant
191
191
  ```sh
192
- yarn run mocha src/AdvancedTable/BodyCells/CellAccount.spec.js
192
+ yarn run mocha packages/hipay-material-ui/src/HiRadio/HiRadio.test.js
193
193
  ```
194
194
 
195
195
  #### Vérifier la couverture de code
@@ -269,6 +269,14 @@ Ainsi les PATCH seront automatiquement pris en compte.
269
269
  L'intégration d'une MINOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md).
270
270
  Le passage à une autre MAJOR doit faire l'objet d'une recette (voir HI-CHANGELOG.md BREAKING CHANGE).
271
271
 
272
+ ## Importer la lib dans son projet React
273
+
274
+ Le package est publié sur un repo npm privé.
275
+
276
+ Il est donc nécessaire d'ajouter le token d'authentification dans le fichier ``.npmrc``.
277
+
278
+ Demander à l'équipe PSYCHE ou le copier depuis le projet [console](https://gitlab.hipay.org/backend/console/blob/feature/common-notice/.npmrc).
279
+
272
280
  # Si ERR d'authentification
273
281
  npm adduser
274
282
  admin
@@ -11,23 +11,24 @@ import DialogTitle from '@material-ui/core/DialogTitle';
11
11
  import { withStyles } from '../styles';
12
12
  import HiButton from '../HiButton';
13
13
  import HiIcon from '../HiIcon';
14
+ import { escapeHTML } from '../utils/helpers';
14
15
  export const styles = theme => ({
15
16
  classContent: {
16
17
  fontSize: 14,
17
- lineHeight: '20px',
18
+ lineHeight: '24px',
18
19
  color: '#484848',
19
20
  position: 'relative'
20
21
  },
21
22
  classDialogPaper: {
22
- minHeight: 280,
23
+ minHeight: 248,
23
24
  maxWidth: 280,
24
25
  borderRadius: 2
25
26
  },
26
27
  classCancelButton: {
27
- float: 'right'
28
+ margin: '0'
28
29
  },
29
30
  classSubmitButton: {
30
- margin: '0'
31
+ float: 'right'
31
32
  },
32
33
  classTitle: {
33
34
  fontSize: 20,
@@ -60,18 +61,6 @@ class HiAlertModal extends React.PureComponent {
60
61
  constructor(props) {
61
62
  super(props);
62
63
 
63
- this.handleClickCancel = () => {
64
- if (this.props.onCancelClick) {
65
- this.props.onCancelClick();
66
- }
67
- };
68
-
69
- this.handleClickSubmit = () => {
70
- if (this.props.onSubmitClick) {
71
- this.props.onSubmitClick();
72
- }
73
- };
74
-
75
64
  this.handleOnClose = () => {
76
65
  if (this.props.onClose) {
77
66
  this.props.onClose();
@@ -79,9 +68,7 @@ class HiAlertModal extends React.PureComponent {
79
68
  };
80
69
 
81
70
  this.handleOnClose = this.handleOnClose.bind(this);
82
- this.handleClickCancel = this.handleClickCancel.bind(this);
83
- this.handleClickSubmit = this.handleClickSubmit.bind(this);
84
- } // Appelé au clic du bouton d'annulation
71
+ } // Appelé si clic en dehors de la pop up
85
72
 
86
73
 
87
74
  // Render
@@ -103,6 +90,17 @@ class HiAlertModal extends React.PureComponent {
103
90
  } = _this$props,
104
91
  props = _objectWithoutProperties(_this$props, ["backgroundIcon", "iconSize", "classes", "content", "labelCancelButton", "labelSubmitButton", "onCancelClick", "onSubmitClick", "open", "cancelColor", "submitColor", "title"]);
105
92
 
93
+ let dialogContent = content;
94
+
95
+ if (typeof content === 'string') {
96
+ dialogContent = React.createElement("span", {
97
+ // eslint-disable-next-line react/no-danger
98
+ dangerouslySetInnerHTML: {
99
+ __html: escapeHTML(content)
100
+ }
101
+ });
102
+ }
103
+
106
104
  return React.createElement(Dialog, _extends({
107
105
  open: open,
108
106
  onClose: this.handleOnClose,
@@ -124,28 +122,29 @@ class HiAlertModal extends React.PureComponent {
124
122
  classes: {
125
123
  root: classes.classContent
126
124
  }
127
- }, content)), React.createElement(DialogActions, {
125
+ }, dialogContent)), React.createElement(DialogActions, {
128
126
  classes: {
129
127
  root: classes.classAction
130
128
  }
131
- }, labelSubmitButton && React.createElement(HiButton, {
132
- classes: {
133
- root: classes.classSubmitButton
134
- },
135
- onClick: this.handleClickSubmit,
136
- color: submitColor
137
- }, labelSubmitButton), labelCancelButton && React.createElement(HiButton, {
129
+ }, labelCancelButton && React.createElement(HiButton, {
138
130
  classes: {
139
131
  root: classes.classCancelButton
140
132
  },
141
- onClick: this.handleClickCancel,
133
+ onClick: onCancelClick,
142
134
  color: cancelColor
143
- }, labelCancelButton)));
135
+ }, labelCancelButton), labelSubmitButton && React.createElement(HiButton, {
136
+ classes: {
137
+ root: classes.classSubmitButton
138
+ },
139
+ onClick: onSubmitClick,
140
+ color: submitColor
141
+ }, labelSubmitButton)));
144
142
  }
145
143
 
146
144
  }
147
145
 
148
146
  HiAlertModal.defaultProps = {
147
+ content: '',
149
148
  cancelColor: 'neutral',
150
149
  submitColor: 'primary'
151
150
  };