@hipay/hipay-material-ui 2.1.0-RC1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +154 -0
- package/HiDatePicker/HiDatePicker.js +0 -4
- package/HiExpansionPanel/HiExpansionPanel.js +19 -10
- package/HiForm/index.js +17 -1
- package/HiNotice/HiKPI.js +7 -7
- package/HiSelect/HiSelect.js +49 -51
- package/HiSelect/HiSuggestSelect.js +62 -54
- package/HiSelectableList/HiSelectableList.js +28 -9
- package/HiSelectableList/HiSelectableListItem.js +1 -1
- package/es/HiDatePicker/HiDatePicker.js +0 -2
- package/es/HiExpansionPanel/HiExpansionPanel.js +19 -10
- package/es/HiForm/index.js +3 -1
- package/es/HiNotice/HiKPI.js +7 -7
- package/es/HiSelect/HiSelect.js +30 -27
- package/es/HiSelect/HiSuggestSelect.js +61 -52
- package/es/HiSelectableList/HiSelectableList.js +26 -8
- package/es/HiSelectableList/HiSelectableListItem.js +1 -1
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
@@ -8,9 +8,14 @@ import HiSelectableListItem from './HiSelectableListItem';
|
|
8
8
|
import { getNextItemSelectable, foldAccents } from '../utils/helpers';
|
9
9
|
import keycode from 'keycode';
|
10
10
|
import LazyLoad, { forceCheck } from 'react-lazyload';
|
11
|
-
|
11
|
+
import classNames from 'classnames';
|
12
|
+
export const styles = theme => ({
|
12
13
|
root: {
|
13
14
|
padding: 0
|
15
|
+
},
|
16
|
+
suggestionFocus: {
|
17
|
+
backgroundColor: theme.palette.action.hover,
|
18
|
+
fontWeight: theme.typography.fontWeightMedium
|
14
19
|
}
|
15
20
|
});
|
16
21
|
/**
|
@@ -44,7 +49,7 @@ class HiSelectableList extends React.PureComponent {
|
|
44
49
|
}
|
45
50
|
};
|
46
51
|
|
47
|
-
this.buildRecursiveListItem = (item, level = 0) => {
|
52
|
+
this.buildRecursiveListItem = (item, index, level = 0) => {
|
48
53
|
const _this$props = this.props,
|
49
54
|
{
|
50
55
|
checkedIcon,
|
@@ -57,9 +62,11 @@ class HiSelectableList extends React.PureComponent {
|
|
57
62
|
selectedItemIdList,
|
58
63
|
sort,
|
59
64
|
onKeyDown,
|
60
|
-
onKeyUp
|
65
|
+
onKeyUp,
|
66
|
+
suggestionFocusIndex,
|
67
|
+
classes
|
61
68
|
} = _this$props,
|
62
|
-
others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
|
69
|
+
others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "lazy", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp", "suggestionFocusIndex", "classes"]);
|
63
70
|
|
64
71
|
if (sort && item.children) {
|
65
72
|
item.children.sort(this.compareItem);
|
@@ -95,8 +102,13 @@ class HiSelectableList extends React.PureComponent {
|
|
95
102
|
onKeyUp: onKeyUp,
|
96
103
|
selected: selectedItemIdList.includes(item.id) // item props override upper props (disabled, hideCheckbox, icon, level...)
|
97
104
|
,
|
98
|
-
item: item
|
99
|
-
|
105
|
+
item: item,
|
106
|
+
classes: {
|
107
|
+
listItem: classNames({
|
108
|
+
[classes.suggestionFocus]: index === suggestionFocusIndex
|
109
|
+
})
|
110
|
+
}
|
111
|
+
}, item)), item.children && item.children.length > 0 && item.children.filter(subItem => !(subItem.displayed === false)).map(subItem => this.buildRecursiveListItem(subItem, index, level + 1)));
|
100
112
|
|
101
113
|
if (lazy) {
|
102
114
|
return React.createElement(LazyLoad, {
|
@@ -188,7 +200,7 @@ class HiSelectableList extends React.PureComponent {
|
|
188
200
|
this.el = el;
|
189
201
|
}
|
190
202
|
}, itemList.filter(item => !(item.displayed === false)) // don't remove if undefined
|
191
|
-
.map(item => this.buildRecursiveListItem(item)));
|
203
|
+
.map((item, index) => this.buildRecursiveListItem(item, index)));
|
192
204
|
}
|
193
205
|
|
194
206
|
}
|
@@ -277,6 +289,11 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
277
289
|
*/
|
278
290
|
selectedItemIdList: PropTypes.array,
|
279
291
|
|
292
|
+
/**
|
293
|
+
* Index de l'item "focus"
|
294
|
+
*/
|
295
|
+
suggestionFocusIndex: PropTypes.number,
|
296
|
+
|
280
297
|
/**
|
281
298
|
* Tri des éléments selon leur label
|
282
299
|
*/
|
@@ -294,5 +311,6 @@ HiSelectableList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
294
311
|
} : {};
|
295
312
|
export default withStyles(styles, {
|
296
313
|
hiComponent: true,
|
297
|
-
name: 'HmuiHiSelectableList'
|
314
|
+
name: 'HmuiHiSelectableList',
|
315
|
+
index: 51
|
298
316
|
})(HiSelectableList);
|
@@ -330,7 +330,7 @@ class HiSelectableListItem extends React.PureComponent {
|
|
330
330
|
indeterminateIcon: indeterminateIcon
|
331
331
|
}), type === 'image' && img && React.createElement("img", {
|
332
332
|
src: img,
|
333
|
-
alt:
|
333
|
+
alt: '',
|
334
334
|
onError: e => {
|
335
335
|
if (fallbackImage) {
|
336
336
|
e.target.src = `${fallbackImage}`;
|
package/index.es.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED