@hipay/hipay-material-ui 2.0.0-beta.40 → 2.0.0-beta.41
Sign up to get free protection for your applications and to get access to all the features.
- package/HiSelect/HiSelect.js +15 -2
- package/HiSelect/SelectInput.js +31 -5
- package/HiSelectNew/HiNestedSelectField.js +146 -0
- package/HiSelectNew/HiSelect.js +17 -4
- package/HiSelectNew/HiSelectInput.js +33 -5
- package/es/HiSelect/HiSelect.js +14 -2
- package/es/HiSelect/SelectInput.js +28 -4
- package/es/HiSelectNew/HiNestedSelectField.js +111 -0
- package/es/HiSelectNew/HiSelect.js +16 -4
- package/es/HiSelectNew/HiSelectInput.js +29 -4
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/umd/hipay-material-ui.development.js +47 -8
- package/umd/hipay-material-ui.production.min.js +2 -2
@@ -339,6 +339,7 @@ class HiSelect extends React.PureComponent {
|
|
339
339
|
this.handleSearchReset = this.handleSearchReset.bind(this);
|
340
340
|
this.handleSelect = this.handleSelect.bind(this);
|
341
341
|
this.handleSuggestions = this.handleSuggestions.bind(this);
|
342
|
+
this.getInputElement = this.getInputElement.bind(this);
|
342
343
|
}
|
343
344
|
|
344
345
|
static getDerivedStateFromProps(nextProps, prevState) {
|
@@ -351,6 +352,14 @@ class HiSelect extends React.PureComponent {
|
|
351
352
|
return null;
|
352
353
|
}
|
353
354
|
|
355
|
+
getInputElement(el) {
|
356
|
+
this.searchField = el;
|
357
|
+
|
358
|
+
if (this.props.inputRef) {
|
359
|
+
this.props.inputRef(this.searchField);
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
354
363
|
render() {
|
355
364
|
const {
|
356
365
|
classes,
|
@@ -410,9 +419,7 @@ class HiSelect extends React.PureComponent {
|
|
410
419
|
}, !!searchable && React.createElement(HiInput, {
|
411
420
|
value: searchValue,
|
412
421
|
autoFocus: true,
|
413
|
-
inputRef:
|
414
|
-
this.searchField = el;
|
415
|
-
},
|
422
|
+
inputRef: this.getInputElement,
|
416
423
|
onKeyDown: this.handleKeyDownSearch,
|
417
424
|
onChange: this.handleSearch,
|
418
425
|
onReset: this.handleSearchReset,
|
@@ -456,6 +463,7 @@ class HiSelect extends React.PureComponent {
|
|
456
463
|
onSubmit: onSubmit,
|
457
464
|
onMouseEnter: this.props.onMouseEnter,
|
458
465
|
onMouseLeave: this.props.onMouseLeave,
|
466
|
+
onReset: this.props.onReset,
|
459
467
|
placeholder: placeholder
|
460
468
|
}, hiSelectInputProps, {
|
461
469
|
refElement: el => {
|
@@ -467,7 +475,6 @@ class HiSelect extends React.PureComponent {
|
|
467
475
|
anchorEl: this.inputEl,
|
468
476
|
placement: "bottom-start",
|
469
477
|
open: open,
|
470
|
-
eventsEnabled: open,
|
471
478
|
className: classes.popper,
|
472
479
|
disablePortal: true
|
473
480
|
}, content));
|
@@ -586,6 +593,11 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
586
593
|
*/
|
587
594
|
onMouseLeave: PropTypes.func,
|
588
595
|
|
596
|
+
/**
|
597
|
+
* Fonction de callback appelée lorsqu'on vide le champs
|
598
|
+
*/
|
599
|
+
onReset: PropTypes.func,
|
600
|
+
|
589
601
|
/**
|
590
602
|
* Fonction de callback appelée lorsque le scroll atteint le bas de la liste
|
591
603
|
*/
|
@@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|
5
5
|
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
|
6
6
|
import ButtonBase from '@material-ui/core/ButtonBase';
|
7
7
|
import Icon from '@material-ui/core/Icon';
|
8
|
+
import HiIcon from '../HiIcon';
|
8
9
|
import withStyles from '../styles/withStyles';
|
9
10
|
import keycode from 'keycode';
|
10
11
|
export const styles = theme => ({
|
@@ -134,7 +135,14 @@ class HiSelectInput extends React.PureComponent {
|
|
134
135
|
}
|
135
136
|
};
|
136
137
|
|
138
|
+
this.handleClick = event => {
|
139
|
+
if ((!this.resetIcon || !this.resetIcon.contains(event.target)) && this.props.onClick) {
|
140
|
+
this.props.onClick(event);
|
141
|
+
}
|
142
|
+
};
|
143
|
+
|
137
144
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
145
|
+
this.handleClick = this.handleClick.bind(this);
|
138
146
|
}
|
139
147
|
|
140
148
|
render() {
|
@@ -143,13 +151,15 @@ class HiSelectInput extends React.PureComponent {
|
|
143
151
|
noButton,
|
144
152
|
disabled,
|
145
153
|
onClick,
|
154
|
+
onReset,
|
146
155
|
value,
|
147
156
|
open,
|
148
157
|
focused,
|
149
158
|
error,
|
150
159
|
id,
|
151
160
|
placeholder,
|
152
|
-
refElement
|
161
|
+
refElement,
|
162
|
+
theme
|
153
163
|
} = this.props; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
|
154
164
|
|
155
165
|
const rootClass = classNames(classes.root, classes.inkbar, classes.underline, {
|
@@ -184,7 +194,7 @@ class HiSelectInput extends React.PureComponent {
|
|
184
194
|
})) : React.createElement(ButtonBase, {
|
185
195
|
id: id,
|
186
196
|
className: rootClass,
|
187
|
-
onClick:
|
197
|
+
onClick: this.handleClick,
|
188
198
|
disabled: disabled,
|
189
199
|
onMouseEnter: this.props.onMouseEnter,
|
190
200
|
onMouseLeave: this.props.onMouseLeave,
|
@@ -198,7 +208,16 @@ class HiSelectInput extends React.PureComponent {
|
|
198
208
|
className: classNames(classes.label, {
|
199
209
|
[classes.placeholder]: value === undefined
|
200
210
|
})
|
201
|
-
}, value || placeholder), React.createElement(
|
211
|
+
}, value || placeholder), onReset && focused && React.createElement("div", {
|
212
|
+
ref: el => {
|
213
|
+
this.resetIcon = el;
|
214
|
+
}
|
215
|
+
}, React.createElement(HiIcon, {
|
216
|
+
icon: "close",
|
217
|
+
size: 24,
|
218
|
+
color: theme.palette.neutral.main,
|
219
|
+
onClick: onReset
|
220
|
+
})), React.createElement(Icon, {
|
202
221
|
classes: {
|
203
222
|
root: iconClass
|
204
223
|
}
|
@@ -276,6 +295,11 @@ HiSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
276
295
|
*/
|
277
296
|
onMouseLeave: PropTypes.func,
|
278
297
|
|
298
|
+
/**
|
299
|
+
* Fonction de callback appelée lorsqu'on vide le champs
|
300
|
+
*/
|
301
|
+
onReset: PropTypes.func,
|
302
|
+
|
279
303
|
/**
|
280
304
|
* Fonction de callback à la pression de la touche "Entrée"
|
281
305
|
*/
|
@@ -303,5 +327,6 @@ HiSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
303
327
|
} : {};
|
304
328
|
export default withStyles(styles, {
|
305
329
|
hiComponent: true,
|
306
|
-
name: 'HmuiHiSelectInput'
|
330
|
+
name: 'HmuiHiSelectInput',
|
331
|
+
withTheme: true
|
307
332
|
})(HiSelectInput);
|
package/index.es.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@hipay/hipay-material-ui",
|
3
3
|
"private": false,
|
4
4
|
"author": "HiPay PSYCHE Team",
|
5
|
-
"version": "2.0.0-beta.
|
5
|
+
"version": "2.0.0-beta.41",
|
6
6
|
"description": "React components that implement Google's Material Design.",
|
7
7
|
"keywords": [
|
8
8
|
"react",
|
@@ -71,4 +71,4 @@
|
|
71
71
|
},
|
72
72
|
"main": "./index.js",
|
73
73
|
"module": "./index.es.js"
|
74
|
-
}
|
74
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/** @license HiPay-Material-UI v2.0.0-beta.
|
1
|
+
/** @license HiPay-Material-UI v2.0.0-beta.41
|
2
2
|
*
|
3
3
|
* This source code is licensed under the MIT license found in the
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
@@ -96492,26 +96492,37 @@
|
|
96492
96492
|
}
|
96493
96493
|
};
|
96494
96494
|
|
96495
|
+
_this.handleClick = function (event) {
|
96496
|
+
if ((!_this.resetIcon || !_this.resetIcon.contains(event.target)) && _this.props.onClick) {
|
96497
|
+
_this.props.onClick(event);
|
96498
|
+
}
|
96499
|
+
};
|
96500
|
+
|
96495
96501
|
_this.handleKeyDown = _this.handleKeyDown.bind(assertThisInitialized(assertThisInitialized(_this)));
|
96502
|
+
_this.handleClick = _this.handleClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
96496
96503
|
return _this;
|
96497
96504
|
}
|
96498
96505
|
|
96499
96506
|
createClass(SelectInput, [{
|
96500
96507
|
key: "render",
|
96501
96508
|
value: function render() {
|
96502
|
-
var _classNames,
|
96509
|
+
var _classNames,
|
96510
|
+
_classNames2,
|
96511
|
+
_this2 = this;
|
96503
96512
|
|
96504
96513
|
var _this$props = this.props,
|
96505
96514
|
classes = _this$props.classes,
|
96506
96515
|
noButton = _this$props.noButton,
|
96507
96516
|
disabled = _this$props.disabled,
|
96508
96517
|
onClick = _this$props.onClick,
|
96518
|
+
onReset = _this$props.onReset,
|
96509
96519
|
value = _this$props.value,
|
96510
96520
|
open = _this$props.open,
|
96511
96521
|
focused = _this$props.focused,
|
96512
96522
|
error = _this$props.error,
|
96513
96523
|
id = _this$props.id,
|
96514
|
-
refElement = _this$props.refElement
|
96524
|
+
refElement = _this$props.refElement,
|
96525
|
+
theme = _this$props.theme; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
|
96515
96526
|
|
96516
96527
|
var rootClass = classnames(classes.root, classes.inkbar, classes.underline, (_classNames = {}, defineProperty(_classNames, classes.disabled, disabled), defineProperty(_classNames, classes.focused, focused), defineProperty(_classNames, classes.error, error && !focused), _classNames));
|
96517
96528
|
var iconClass = classnames(classes.icon, (_classNames2 = {}, defineProperty(_classNames2, classes.iconOpen, open), defineProperty(_classNames2, classes.iconClose, !open), _classNames2));
|
@@ -96540,7 +96551,7 @@
|
|
96540
96551
|
classes: {
|
96541
96552
|
root: rootClass
|
96542
96553
|
},
|
96543
|
-
onClick:
|
96554
|
+
onClick: this.handleClick,
|
96544
96555
|
disabled: disabled,
|
96545
96556
|
onMouseEnter: this.props.onMouseEnter,
|
96546
96557
|
onMouseLeave: this.props.onMouseLeave,
|
@@ -96552,7 +96563,16 @@
|
|
96552
96563
|
}
|
96553
96564
|
}, React__default.createElement("span", {
|
96554
96565
|
className: classes.label
|
96555
|
-
}, value), React__default.createElement(
|
96566
|
+
}, value), onReset && focused && React__default.createElement("div", {
|
96567
|
+
ref: function ref(el) {
|
96568
|
+
_this2.resetIcon = el;
|
96569
|
+
}
|
96570
|
+
}, React__default.createElement(HiIcon$1, {
|
96571
|
+
icon: "close",
|
96572
|
+
size: 24,
|
96573
|
+
color: theme.palette.neutral.main,
|
96574
|
+
onClick: onReset
|
96575
|
+
})), React__default.createElement(HiIcon$1, {
|
96556
96576
|
className: iconClass,
|
96557
96577
|
icon: "arrow_drop_down"
|
96558
96578
|
}));
|
@@ -96627,6 +96647,11 @@
|
|
96627
96647
|
*/
|
96628
96648
|
onMouseLeave: propTypes.func,
|
96629
96649
|
|
96650
|
+
/**
|
96651
|
+
* Fonction de callback appelée lorsqu'on vide le champs
|
96652
|
+
*/
|
96653
|
+
onReset: propTypes.func,
|
96654
|
+
|
96630
96655
|
/**
|
96631
96656
|
* Fonction de callback à la pression de la touche "Entrée"
|
96632
96657
|
*/
|
@@ -96649,7 +96674,8 @@
|
|
96649
96674
|
};
|
96650
96675
|
var SelectInput$1 = withStyles(styles$p, {
|
96651
96676
|
hiComponent: true,
|
96652
|
-
name: 'HmuiSelectInput'
|
96677
|
+
name: 'HmuiSelectInput',
|
96678
|
+
withTheme: true
|
96653
96679
|
})(SelectInput);
|
96654
96680
|
|
96655
96681
|
var styles$q = function styles(theme) {
|
@@ -97143,6 +97169,14 @@
|
|
97143
97169
|
});
|
97144
97170
|
}
|
97145
97171
|
}
|
97172
|
+
}, {
|
97173
|
+
key: "handleReset",
|
97174
|
+
value: function handleReset(event) {
|
97175
|
+
if (this.props.onReset) {
|
97176
|
+
event.stopPropagation();
|
97177
|
+
this.props.onReset(event);
|
97178
|
+
}
|
97179
|
+
}
|
97146
97180
|
}, {
|
97147
97181
|
key: "render",
|
97148
97182
|
value: function render() {
|
@@ -97339,14 +97373,14 @@
|
|
97339
97373
|
onMouseLeave: this.props.onMouseLeave,
|
97340
97374
|
refElement: function refElement(el) {
|
97341
97375
|
_this2.selectInputElement = el;
|
97342
|
-
}
|
97376
|
+
},
|
97377
|
+
onReset: this.props.onReset
|
97343
97378
|
}), open && staticPosition ? React__default.createElement("div", {
|
97344
97379
|
style: popperStyle
|
97345
97380
|
}, content) : React__default.createElement(Popper$3, {
|
97346
97381
|
anchorEl: this.inputEl,
|
97347
97382
|
placement: "bottom-start",
|
97348
97383
|
open: open,
|
97349
|
-
eventsEnabled: open,
|
97350
97384
|
className: popperClass,
|
97351
97385
|
style: popperStyle,
|
97352
97386
|
disablePortal: true
|
@@ -97519,6 +97553,11 @@
|
|
97519
97553
|
*/
|
97520
97554
|
onMouseLeave: propTypes.func,
|
97521
97555
|
|
97556
|
+
/**
|
97557
|
+
* Fonction de callback appelée lorsqu'on vide le champs
|
97558
|
+
*/
|
97559
|
+
onReset: propTypes.func,
|
97560
|
+
|
97522
97561
|
/**
|
97523
97562
|
* Fonction de callback appelée lorsqu'on écrit dans la barre de recherche
|
97524
97563
|
* A utiliser pour les selects avec des données dynamiques
|