@hipay/hipay-material-ui 2.0.0-beta.57 → 2.0.0-beta.59
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +117 -0
- package/HiAlertModal/HiAlertModal.js +56 -13
- package/HiColoredLabel/HiColoredLabel.js +16 -4
- package/HiForm/HiFormControl.js +2 -4
- package/HiForm/HiInput.js +29 -4
- package/HiForm/HiUploadField.js +2 -1
- package/HiSelect/HiSelect.js +6 -5
- package/HiSelect/HiSuggestSelect.js +5 -4
- package/HiSelect/SelectInput.js +1 -0
- package/HiSelectNew/HiNestedSelect.js +20 -6
- package/HiSelectNew/HiNestedSelectContent.js +20 -6
- package/HiSelectNew/HiSelect.js +104 -32
- package/HiSelectNew/HiSelectContent.js +16 -4
- package/HiSelectNew/HiSelectInput.js +10 -3
- package/HiSelectableList/HiSelectableList.js +2 -35
- package/HiSelectableList/HiSelectableListItem.js +6 -4
- package/es/HiAlertModal/HiAlertModal.js +55 -13
- package/es/HiColoredLabel/HiColoredLabel.js +21 -4
- package/es/HiForm/HiFormControl.js +2 -4
- package/es/HiForm/HiInput.js +29 -4
- package/es/HiForm/HiUploadField.js +2 -1
- package/es/HiSelect/HiSelect.js +6 -5
- package/es/HiSelect/HiSuggestSelect.js +5 -4
- package/es/HiSelect/SelectInput.js +1 -0
- package/es/HiSelectNew/HiNestedSelect.js +17 -7
- package/es/HiSelectNew/HiNestedSelectContent.js +16 -6
- package/es/HiSelectNew/HiSelect.js +106 -31
- package/es/HiSelectNew/HiSelectContent.js +11 -2
- package/es/HiSelectNew/HiSelectInput.js +10 -3
- package/es/HiSelectableList/HiSelectableList.js +3 -29
- package/es/HiSelectableList/HiSelectableListItem.js +6 -4
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/umd/hipay-material-ui.development.js +15551 -16279
- package/umd/hipay-material-ui.production.min.js +2 -2
@@ -37,6 +37,9 @@ export const styles = theme => ({
|
|
37
37
|
width: '100%'
|
38
38
|
})
|
39
39
|
});
|
40
|
+
export var filterValue = function (item, searchValue) {
|
41
|
+
return searchValue === '' || foldAccents(item.label.toString().toLowerCase()).search(foldAccents(searchValue.toLowerCase())) !== -1;
|
42
|
+
};
|
40
43
|
/**
|
41
44
|
*
|
42
45
|
* Utilisé pour tous types de selects dans les formulaires.
|
@@ -197,7 +200,7 @@ class HiSelectContent extends React.PureComponent {
|
|
197
200
|
hideCheckbox: true,
|
198
201
|
label: 'loading'
|
199
202
|
}] : []), // simple one level filter on label
|
200
|
-
...(search !== '' ? [...options.filter(item => item.label &&
|
203
|
+
...(search !== '' ? [...options.filter(item => item.label && this.props.filterFunc(item, search))] : [...(this.props.hasAll ? [_objectSpread({
|
201
204
|
id: '_all',
|
202
205
|
label: this.props.translations.all
|
203
206
|
}, this.props.iconAll && {
|
@@ -331,7 +334,8 @@ HiSelectContent.defaultProps = {
|
|
331
334
|
n_children: '%s items',
|
332
335
|
one_child: '%s item'
|
333
336
|
},
|
334
|
-
type: 'text'
|
337
|
+
type: 'text',
|
338
|
+
filterFunc: filterValue
|
335
339
|
};
|
336
340
|
HiSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
337
341
|
autoHeight: PropTypes.bool,
|
@@ -356,6 +360,11 @@ HiSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
356
360
|
*/
|
357
361
|
fallbackImage: PropTypes.string,
|
358
362
|
|
363
|
+
/*
|
364
|
+
* Fonction de filtrage custom
|
365
|
+
*/
|
366
|
+
filterFunc: PropTypes.func,
|
367
|
+
|
359
368
|
/**
|
360
369
|
* Affiche l'élément 'All'
|
361
370
|
*/
|
@@ -146,8 +146,12 @@ class HiSelectInput extends React.PureComponent {
|
|
146
146
|
};
|
147
147
|
|
148
148
|
this.handleClick = event => {
|
149
|
+
// Do not open select if press on resetIcon
|
149
150
|
if ((!this.resetIcon || !this.resetIcon.contains(event.target)) && this.props.onClick) {
|
150
|
-
|
151
|
+
// Do not open select if press enter on button => submit form
|
152
|
+
if (event.type !== 'keydown' || keycode(event) !== 'enter') {
|
153
|
+
this.props.onClick(event);
|
154
|
+
}
|
151
155
|
}
|
152
156
|
};
|
153
157
|
|
@@ -162,9 +166,11 @@ class HiSelectInput extends React.PureComponent {
|
|
162
166
|
this.handleBlur = event => {
|
163
167
|
if ((!this.input || !this.input.contains(event.relatedTarget)) && this.props.onBlur) {
|
164
168
|
this.props.onBlur(event);
|
165
|
-
} else if (this.input && (!this.resetIcon || !this.resetIcon.contains(event.relatedTarget))) {
|
166
|
-
this.input.focus();
|
167
169
|
}
|
170
|
+
/* else if (this.input && (!this.resetIcon || !this.resetIcon.contains(event.relatedTarget))) {
|
171
|
+
this.input.focus();
|
172
|
+
}*/
|
173
|
+
|
168
174
|
};
|
169
175
|
|
170
176
|
this.ref = el => {
|
@@ -225,6 +231,7 @@ class HiSelectInput extends React.PureComponent {
|
|
225
231
|
}, value || placeholder), React.createElement(ArrowDropDownIcon, {
|
226
232
|
className: iconClass
|
227
233
|
})) : React.createElement(ButtonBase, {
|
234
|
+
component: "div",
|
228
235
|
id: id,
|
229
236
|
className: rootClass,
|
230
237
|
onClick: this.handleClick,
|
@@ -5,8 +5,7 @@ import PropTypes from 'prop-types';
|
|
5
5
|
import List from '@material-ui/core/List';
|
6
6
|
import withStyles from '../styles/withStyles';
|
7
7
|
import HiSelectableListItem from './HiSelectableListItem';
|
8
|
-
import { foldAccents
|
9
|
-
import keycode from 'keycode';
|
8
|
+
import { foldAccents } from '../utils/helpers';
|
10
9
|
export const styles = () => ({
|
11
10
|
root: {
|
12
11
|
padding: 0
|
@@ -24,31 +23,6 @@ class HiSelectableList extends React.PureComponent {
|
|
24
23
|
this.props.onSelect(event, item);
|
25
24
|
};
|
26
25
|
|
27
|
-
this.handleKeyDown = event => {
|
28
|
-
let nextItem;
|
29
|
-
const key = keycode(event);
|
30
|
-
|
31
|
-
if (key === 'down') {
|
32
|
-
event.preventDefault();
|
33
|
-
nextItem = getNextItemSelectable(document.activeElement, 'down');
|
34
|
-
} else if (key === 'up') {
|
35
|
-
event.preventDefault();
|
36
|
-
nextItem = getNextItemSelectable(document.activeElement, 'up');
|
37
|
-
} else if (key === 'space' || key === 'enter' && !this.props.multiple) {
|
38
|
-
event.preventDefault();
|
39
|
-
const item = this.props.options.find(elem => String(elem.id) === event.target.id);
|
40
|
-
this.handleSelect(null, item);
|
41
|
-
}
|
42
|
-
|
43
|
-
if (nextItem) {
|
44
|
-
nextItem.focus();
|
45
|
-
}
|
46
|
-
};
|
47
|
-
|
48
|
-
this.handleKeyUp = () => {
|
49
|
-
return false;
|
50
|
-
};
|
51
|
-
|
52
26
|
this.buildRecursiveListItem = (item, level = 0) => {
|
53
27
|
const _this$props = this.props,
|
54
28
|
{
|
@@ -60,8 +34,8 @@ class HiSelectableList extends React.PureComponent {
|
|
60
34
|
icon,
|
61
35
|
selectedItemIdList,
|
62
36
|
sort,
|
63
|
-
onKeyDown
|
64
|
-
onKeyUp
|
37
|
+
onKeyDown,
|
38
|
+
onKeyUp
|
65
39
|
} = _this$props,
|
66
40
|
others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown", "onKeyUp"]);
|
67
41
|
|
@@ -85,12 +85,13 @@ export const styles = theme => ({
|
|
85
85
|
minWidth: '50%',
|
86
86
|
padding: '5px 0',
|
87
87
|
'&$listItemContentSelected': {
|
88
|
-
marginBottom:
|
88
|
+
marginBottom: 1,
|
89
89
|
marginLeft: -4
|
90
90
|
},
|
91
91
|
'& strong': {
|
92
92
|
fontWeight: theme.typography.fontWeightMedium
|
93
|
-
}
|
93
|
+
},
|
94
|
+
display: 'inline-flex'
|
94
95
|
}),
|
95
96
|
listItemContentSelected: {},
|
96
97
|
label: {
|
@@ -136,7 +137,7 @@ export const styles = theme => ({
|
|
136
137
|
labelContent: {
|
137
138
|
display: 'flex',
|
138
139
|
alignItems: 'center',
|
139
|
-
maxWidth: '
|
140
|
+
maxWidth: '85%',
|
140
141
|
'&$labelWithoutSecondaryInline': {
|
141
142
|
maxWidth: '100%'
|
142
143
|
}
|
@@ -225,7 +226,8 @@ class HiSelectableListItem extends React.PureComponent {
|
|
225
226
|
}
|
226
227
|
|
227
228
|
return React.createElement("div", {
|
228
|
-
className: classes.label
|
229
|
+
className: classes.label,
|
230
|
+
title: label
|
229
231
|
}, label);
|
230
232
|
}
|
231
233
|
|
package/index.es.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED