@hipay/hipay-material-ui 1.0.0-beta.22 → 1.0.0-beta.25
Sign up to get free protection for your applications and to get access to all the features.
- package/HI-CHANGELOG.md +26 -43
- package/HiChip/HiChip.js +67 -8
- package/HiChip/HiChipSwitch.js +6 -0
- package/HiDatePicker/HiDatePicker.js +35 -21
- package/HiDatePicker/HiDateRangePicker.js +92 -50
- package/HiDatePicker/HiDateRangeSelector.js +15 -4
- package/HiDatePicker/Overlays/Overlay.js +1 -1
- package/HiDatePicker/stylesheet.js +3 -0
- package/HiForm/HiInput.js +12 -2
- package/HiForm/HiPasswordField.js +8 -3
- package/HiLoader/HiLoader.js +7 -4
- package/HiPins/HiPins.js +6 -4
- package/HiSelect/HiSelect.js +26 -6
- package/HiSelect/HiSuggestSelect.js +2 -1
- package/HiSelect/SelectInput.js +3 -8
- package/HiSelectableList/HiSelectableList.js +51 -49
- package/HiSelectableList/HiSelectableListItem.js +18 -2
- package/HiTable/BodyCellBuilder.js +22 -12
- package/HiTable/BodyCells/CellAccount.js +13 -4
- package/HiTable/BodyCells/CellAccountNumber.js +12 -3
- package/HiTable/BodyCells/CellAddress.js +12 -3
- package/HiTable/BodyCells/CellCountry.js +12 -3
- package/HiTable/BodyCells/CellDate.js +43 -42
- package/HiTable/BodyCells/CellIcon.js +12 -3
- package/HiTable/BodyCells/CellImage.js +12 -3
- package/HiTable/BodyCells/CellNumeric.js +12 -3
- package/HiTable/BodyCells/CellRate.js +12 -3
- package/HiTable/BodyCells/CellSentinel.js +17 -7
- package/HiTable/BodyCells/CellStatus.js +13 -4
- package/HiTable/BodyCells/CellText.js +17 -7
- package/HiTable/BodyCells/CellThirdPartySecurity.js +12 -3
- package/HiTable/BodyRow.js +12 -3
- package/HiTable/ColumnFilter.js +2 -5
- package/HiTable/HeaderCell.js +21 -11
- package/HiTable/HiStickyRow.js +24 -13
- package/HiTable/HiTable.js +30 -69
- package/HiTable/HiTableBody.js +99 -29
- package/HiTable/HiTableContextMenu.js +31 -16
- package/HiTable/HiTableFooter.js +9 -0
- package/HiTable/HiTableHead.js +15 -7
- package/HiTopBar/HiTopBar.js +6 -0
- package/README.md +71 -6
- package/es/HiChip/HiChip.js +79 -8
- package/es/HiChip/HiChipSwitch.js +6 -0
- package/es/HiDatePicker/HiDatePicker.js +30 -21
- package/es/HiDatePicker/HiDateRangePicker.js +86 -52
- package/es/HiDatePicker/HiDateRangeSelector.js +14 -4
- package/es/HiDatePicker/Overlays/Overlay.js +1 -1
- package/es/HiDatePicker/stylesheet.js +3 -0
- package/es/HiForm/HiInput.js +12 -2
- package/es/HiForm/HiPasswordField.js +8 -3
- package/es/HiLoader/HiLoader.js +3 -3
- package/es/HiPins/HiPins.js +4 -4
- package/es/HiSelect/HiSelect.js +25 -6
- package/es/HiSelect/HiSuggestSelect.js +2 -1
- package/es/HiSelect/SelectInput.js +3 -8
- package/es/HiSelectableList/HiSelectableList.js +51 -49
- package/es/HiSelectableList/HiSelectableListItem.js +15 -2
- package/es/HiTable/BodyCellBuilder.js +8 -2
- package/es/HiTable/BodyCells/CellAccount.js +7 -2
- package/es/HiTable/BodyCells/CellAccountNumber.js +6 -1
- package/es/HiTable/BodyCells/CellAddress.js +6 -1
- package/es/HiTable/BodyCells/CellCountry.js +6 -1
- package/es/HiTable/BodyCells/CellDate.js +28 -37
- package/es/HiTable/BodyCells/CellIcon.js +6 -1
- package/es/HiTable/BodyCells/CellImage.js +6 -1
- package/es/HiTable/BodyCells/CellNumeric.js +6 -1
- package/es/HiTable/BodyCells/CellRate.js +6 -1
- package/es/HiTable/BodyCells/CellSentinel.js +6 -1
- package/es/HiTable/BodyCells/CellStatus.js +7 -2
- package/es/HiTable/BodyCells/CellText.js +6 -1
- package/es/HiTable/BodyCells/CellThirdPartySecurity.js +6 -1
- package/es/HiTable/BodyRow.js +7 -2
- package/es/HiTable/ColumnFilter.js +2 -5
- package/es/HiTable/HeaderCell.js +16 -9
- package/es/HiTable/HiStickyRow.js +20 -13
- package/es/HiTable/HiTable.js +4 -40
- package/es/HiTable/HiTableBody.js +78 -26
- package/es/HiTable/HiTableContextMenu.js +28 -16
- package/es/HiTable/HiTableFooter.js +5 -0
- package/es/HiTable/HiTableHead.js +11 -6
- package/es/HiTopBar/HiTopBar.js +5 -0
- package/es/utils/HiIconBuilder.js +6 -2
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +6 -1
- package/umd/hipay-material-ui.development.js +99120 -65306
- package/umd/hipay-material-ui.production.min.js +5 -5
- package/utils/HiIconBuilder.js +6 -2
@@ -1,3 +1,4 @@
|
|
1
|
+
import _Object$values from 'babel-runtime/core-js/object/values';
|
1
2
|
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
2
3
|
import _extends from 'babel-runtime/helpers/extends';
|
3
4
|
// weak
|
@@ -25,10 +26,22 @@ class HiDateRangePicker extends React.Component {
|
|
25
26
|
constructor(props) {
|
26
27
|
super();
|
27
28
|
|
29
|
+
this.handleInputChange = inputName => event => {
|
30
|
+
this.event = event;
|
31
|
+
this.props.onChange(inputName, event.target.value);
|
32
|
+
};
|
33
|
+
|
28
34
|
this.handleDayPickerFocus = name => () => {
|
29
35
|
this.setState({ focusedInput: name });
|
30
36
|
};
|
31
37
|
|
38
|
+
this.handleDayPickerBlur = name => () => {
|
39
|
+
this.setState({ focusedInput: '' });
|
40
|
+
if (this.props.onBlur) {
|
41
|
+
this.props.onBlur(name);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
32
45
|
this.state = {
|
33
46
|
fromCurrentMonth: props.from ? props.from : new Date(),
|
34
47
|
toCurrentMonth: props.to ? props.to : new Date(),
|
@@ -58,6 +71,7 @@ class HiDateRangePicker extends React.Component {
|
|
58
71
|
this.handleYearClickTo = this.handleYearClickTo.bind(this);
|
59
72
|
this.handleDayPickerFocus = this.handleDayPickerFocus.bind(this);
|
60
73
|
this.handleDayPickerBlur = this.handleDayPickerBlur.bind(this);
|
74
|
+
this.handleInputChange = this.handleInputChange.bind(this);
|
61
75
|
|
62
76
|
this.openPanel = this.openPanel.bind(this);
|
63
77
|
|
@@ -94,11 +108,7 @@ class HiDateRangePicker extends React.Component {
|
|
94
108
|
}
|
95
109
|
|
96
110
|
handleReset(name) {
|
97
|
-
|
98
|
-
this.handleCurrentMonthChange(name, new Date());
|
99
|
-
} else {
|
100
|
-
this.handleCurrentMonthChange(name, this.props.from);
|
101
|
-
}
|
111
|
+
this.handleCurrentMonthChange(name, new Date());
|
102
112
|
|
103
113
|
this.timeout = setTimeout(() => {
|
104
114
|
if (this.props.onReset) {
|
@@ -108,38 +118,45 @@ class HiDateRangePicker extends React.Component {
|
|
108
118
|
}
|
109
119
|
|
110
120
|
handleDayChange(name, day, modifiers) {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
if (
|
115
|
-
if (
|
116
|
-
this.toInput
|
117
|
-
|
118
|
-
|
121
|
+
if (day) {
|
122
|
+
// if time disabled, focus TO input
|
123
|
+
// else focus current input
|
124
|
+
if (!this.props.enableTime) {
|
125
|
+
if (day instanceof Date) {
|
126
|
+
if (name === 'from' && this.toInput) {
|
127
|
+
this.toInput.getInput().focus();
|
128
|
+
} else if (name === 'to') {
|
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;
|
135
|
+
}
|
119
136
|
}
|
137
|
+
} else {
|
138
|
+
this.timeout = setTimeout(() => {
|
139
|
+
if (this[`${name}Input`].getInput()) {
|
140
|
+
this[`${name}Input`].getInput().focus();
|
141
|
+
}
|
142
|
+
}, 10);
|
120
143
|
}
|
121
|
-
} else {
|
122
|
-
this.timeout = setTimeout(() => {
|
123
|
-
if (this[`${name}Input`].getInput()) {
|
124
|
-
this[`${name}Input`].getInput().focus();
|
125
|
-
}
|
126
|
-
}, 10);
|
127
|
-
}
|
128
144
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
145
|
+
if (this.props.onChange) {
|
146
|
+
// Keep Time if set
|
147
|
+
if (this.props.enableTime) {
|
148
|
+
if (this.props[name]) {
|
149
|
+
day.setHours(this.props[name].getHours(), this.props[name].getMinutes());
|
150
|
+
} else {
|
151
|
+
day.setHours(0, 0);
|
152
|
+
}
|
136
153
|
}
|
154
|
+
this.props.onChange(name, day);
|
137
155
|
}
|
138
|
-
this.props.onChange(name, day);
|
139
|
-
}
|
140
156
|
|
141
|
-
|
142
|
-
|
157
|
+
if (this.props.enableTime) {
|
158
|
+
this.openPanel(name, 'time');
|
159
|
+
}
|
143
160
|
}
|
144
161
|
}
|
145
162
|
handleDayChangeFrom(day, modifiers) {
|
@@ -214,10 +231,6 @@ class HiDateRangePicker extends React.Component {
|
|
214
231
|
}
|
215
232
|
}
|
216
233
|
|
217
|
-
handleDayPickerBlur() {
|
218
|
-
this.setState({ focusedInput: '' });
|
219
|
-
}
|
220
|
-
|
221
234
|
openPanel(name, panel) {
|
222
235
|
this.setState({
|
223
236
|
[`${name}OpenedPanel`]: panel
|
@@ -352,6 +365,20 @@ class HiDateRangePicker extends React.Component {
|
|
352
365
|
}
|
353
366
|
};
|
354
367
|
|
368
|
+
let selectedDays = [];
|
369
|
+
let selected = {};
|
370
|
+
if (from instanceof Date) {
|
371
|
+
selectedDays.push(from);
|
372
|
+
selected.from = from;
|
373
|
+
}
|
374
|
+
if (to instanceof Date) {
|
375
|
+
selectedDays.push(to);
|
376
|
+
selected.to = to;
|
377
|
+
}
|
378
|
+
if (_Object$values(selected).length > 0) {
|
379
|
+
selectedDays.push(selected);
|
380
|
+
}
|
381
|
+
|
355
382
|
const dayPickerProps = _extends({
|
356
383
|
classNames: classes,
|
357
384
|
disabledDays,
|
@@ -361,7 +388,7 @@ class HiDateRangePicker extends React.Component {
|
|
361
388
|
modifiers,
|
362
389
|
modifiersStyles,
|
363
390
|
// Both are required ?
|
364
|
-
selectedDays
|
391
|
+
selectedDays,
|
365
392
|
todayButton: translations.today,
|
366
393
|
weekdayElement: Weekday
|
367
394
|
}, props);
|
@@ -370,9 +397,9 @@ class HiDateRangePicker extends React.Component {
|
|
370
397
|
// Disable days after 'to' date if define
|
371
398
|
|
372
399
|
let after;
|
373
|
-
if (to && disableFutureDays) {
|
400
|
+
if (to instanceof Date && disableFutureDays) {
|
374
401
|
after = to < now ? now : to;
|
375
|
-
} else if (to) {
|
402
|
+
} else if (to instanceof Date) {
|
376
403
|
after = to;
|
377
404
|
} else if (disableFutureDays) {
|
378
405
|
after = now;
|
@@ -399,9 +426,9 @@ class HiDateRangePicker extends React.Component {
|
|
399
426
|
// Disable days before 'from' date if define
|
400
427
|
|
401
428
|
let before;
|
402
|
-
if (from && disablePastDays) {
|
429
|
+
if (from instanceof Date && disablePastDays) {
|
403
430
|
before = from < now ? now : from;
|
404
|
-
} else if (from) {
|
431
|
+
} else if (from instanceof Date) {
|
405
432
|
before = from;
|
406
433
|
} else if (disablePastDays) {
|
407
434
|
before = now;
|
@@ -431,7 +458,8 @@ class HiDateRangePicker extends React.Component {
|
|
431
458
|
}, props, labelFrom && {
|
432
459
|
label: labelFrom
|
433
460
|
}, {
|
434
|
-
id: `${id}-from
|
461
|
+
id: `${id}-from`,
|
462
|
+
onChange: this.handleInputChange('from')
|
435
463
|
});
|
436
464
|
|
437
465
|
const toInputProps = _extends({}, onReset && {
|
@@ -439,15 +467,13 @@ class HiDateRangePicker extends React.Component {
|
|
439
467
|
}, props, labelTo && {
|
440
468
|
label: labelTo
|
441
469
|
}, {
|
442
|
-
id: `${id}-to
|
470
|
+
id: `${id}-to`,
|
471
|
+
onChange: this.handleInputChange('to')
|
443
472
|
});
|
444
473
|
|
445
|
-
let fromClass = classNames({
|
446
|
-
[classes.absolute]: staticPosition === true && this.state.focusedInput === 'to',
|
447
|
-
[classes.dayPickerMargin]: staticPosition === true && this.state.focusedInput === 'to'
|
448
|
-
});
|
449
474
|
let toClass = classNames(classes.toInput, {
|
450
|
-
[classes.absolute]: staticPosition === true && this.state.focusedInput === 'from'
|
475
|
+
[classes.absolute]: staticPosition === true && this.state.focusedInput === 'from',
|
476
|
+
[classes.right4]: staticPosition === true && this.state.focusedInput === 'from'
|
451
477
|
});
|
452
478
|
|
453
479
|
return React.createElement(
|
@@ -458,11 +484,11 @@ class HiDateRangePicker extends React.Component {
|
|
458
484
|
{
|
459
485
|
className: classes.fromInput,
|
460
486
|
onFocus: this.handleDayPickerFocus('from'),
|
461
|
-
onBlur: this.handleDayPickerBlur
|
487
|
+
onBlur: this.handleDayPickerBlur('from')
|
462
488
|
},
|
463
489
|
React.createElement(
|
464
490
|
'div',
|
465
|
-
|
491
|
+
null,
|
466
492
|
React.createElement(DayPickerInput, {
|
467
493
|
ref: el => {
|
468
494
|
this.fromInput = el;
|
@@ -486,7 +512,7 @@ class HiDateRangePicker extends React.Component {
|
|
486
512
|
{
|
487
513
|
className: toClass,
|
488
514
|
onFocus: this.handleDayPickerFocus('to'),
|
489
|
-
onBlur: this.handleDayPickerBlur
|
515
|
+
onBlur: this.handleDayPickerBlur('to')
|
490
516
|
},
|
491
517
|
React.createElement(DayPickerInput, {
|
492
518
|
ref: el => {
|
@@ -560,7 +586,7 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
560
586
|
/**
|
561
587
|
* Date de début sélectionnée
|
562
588
|
*/
|
563
|
-
from: PropTypes.instanceOf(Date),
|
589
|
+
from: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
564
590
|
/**
|
565
591
|
* Utilisé pour construire les ids des champs from et to en les suffixant "-from" et "-to"
|
566
592
|
*/
|
@@ -583,10 +609,18 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
583
609
|
minimumDate: PropTypes.instanceOf(Date),
|
584
610
|
/**
|
585
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
|
586
619
|
*/
|
587
620
|
onChange: PropTypes.func,
|
588
621
|
/**
|
589
622
|
* Callback au reset de l'input
|
623
|
+
* @param {string} nom du champs réinitialisé
|
590
624
|
*/
|
591
625
|
onReset: PropTypes.func,
|
592
626
|
/**
|
@@ -596,7 +630,7 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
596
630
|
/**
|
597
631
|
* Date de fin sélectionnée
|
598
632
|
*/
|
599
|
-
to: PropTypes.instanceOf(Date),
|
633
|
+
to: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
600
634
|
/**
|
601
635
|
* Traductions
|
602
636
|
*/
|
@@ -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.
|
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.
|
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',
|
@@ -301,7 +311,7 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
301
311
|
/**
|
302
312
|
* Date de début sélectionnée
|
303
313
|
*/
|
304
|
-
from: PropTypes.instanceOf(Date),
|
314
|
+
from: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
305
315
|
/**
|
306
316
|
* Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
|
307
317
|
*/
|
@@ -349,7 +359,7 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
349
359
|
/**
|
350
360
|
* Date de fin sélectionnée
|
351
361
|
*/
|
352
|
-
to: PropTypes.instanceOf(Date),
|
362
|
+
to: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
353
363
|
/**
|
354
364
|
* Traductions
|
355
365
|
*/
|
@@ -80,7 +80,7 @@ Overlay.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
80
80
|
* ReactDayPicker prop
|
81
81
|
* The currently selected day or selected days
|
82
82
|
*/
|
83
|
-
selectedDay: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
83
|
+
selectedDay: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
|
84
84
|
/**
|
85
85
|
* Définit comment construire le Paper dans le cas d'un double input
|
86
86
|
*/
|
package/es/HiForm/HiInput.js
CHANGED
@@ -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) {
|
@@ -230,7 +231,8 @@ class HiInput extends React.PureComponent {
|
|
230
231
|
rows,
|
231
232
|
inputClassName,
|
232
233
|
onReset,
|
233
|
-
theme
|
234
|
+
theme,
|
235
|
+
startAdornmentColor
|
234
236
|
} = this.props;
|
235
237
|
|
236
238
|
const { focused } = this.state;
|
@@ -251,11 +253,15 @@ class HiInput extends React.PureComponent {
|
|
251
253
|
});
|
252
254
|
|
253
255
|
let leftIcon;
|
256
|
+
let startAdornmentStyle = { padding: 8 };
|
257
|
+
if (startAdornmentColor) {
|
258
|
+
startAdornmentStyle.color = startAdornmentColor;
|
259
|
+
}
|
254
260
|
if (startAdornment) {
|
255
261
|
leftIcon = React.createElement(HiIconBuilder, {
|
256
262
|
icon: startAdornment,
|
257
263
|
size: 36,
|
258
|
-
style:
|
264
|
+
style: startAdornmentStyle,
|
259
265
|
onClick: this.props.onLeftIconClick,
|
260
266
|
className: classNames(classes.startAdornment, {
|
261
267
|
[classes.startAdornmentFocus]: focused,
|
@@ -454,6 +460,10 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
454
460
|
* Icône à afficher à gauche de l'input
|
455
461
|
*/
|
456
462
|
startAdornment: PropTypes.string,
|
463
|
+
/**
|
464
|
+
* Couleur de l'icône à afficher à gauche de l'input
|
465
|
+
*/
|
466
|
+
startAdornmentColor: PropTypes.string,
|
457
467
|
/**
|
458
468
|
* @ignore
|
459
469
|
*/
|
@@ -11,9 +11,9 @@ import HiTextField from './HiTextField';
|
|
11
11
|
export const styles = theme => ({
|
12
12
|
inputPassword: {
|
13
13
|
fontWeight: 'bolder',
|
14
|
-
fontFamily: '
|
14
|
+
fontFamily: 'inherit',
|
15
15
|
letterSpacing: '4px',
|
16
|
-
fontSize:
|
16
|
+
fontSize: '1.6rem'
|
17
17
|
}
|
18
18
|
});
|
19
19
|
|
@@ -52,7 +52,12 @@ class HiPasswordField extends React.Component {
|
|
52
52
|
return React.createElement(HiTextField, _extends({}, otherProps, {
|
53
53
|
type: type,
|
54
54
|
onRightIconClick: this.handlePasswordToggle,
|
55
|
-
HiInputProps: _extends({}, HiInputProps, {
|
55
|
+
HiInputProps: _extends({}, HiInputProps, {
|
56
|
+
endAdornment,
|
57
|
+
placeholder: '',
|
58
|
+
inputClassName,
|
59
|
+
autocomplete: 'on'
|
60
|
+
})
|
56
61
|
}));
|
57
62
|
}
|
58
63
|
}
|
package/es/HiLoader/HiLoader.js
CHANGED
@@ -6,14 +6,14 @@ import withStyles from '../styles/withStyles';
|
|
6
6
|
export const styles = () => ({});
|
7
7
|
|
8
8
|
function HiLoader(props) {
|
9
|
-
const { theme, loading } = props;
|
9
|
+
const { className, theme, loading, size = 12 } = props;
|
10
10
|
|
11
11
|
return React.createElement(
|
12
12
|
'div',
|
13
|
-
{ id: 'hi-loader' },
|
13
|
+
{ id: 'hi-loader', className: className },
|
14
14
|
React.createElement(PropagateLoader, {
|
15
15
|
loading: loading,
|
16
|
-
size:
|
16
|
+
size: size,
|
17
17
|
color: theme.palette.business.primary.normal
|
18
18
|
})
|
19
19
|
);
|
package/es/HiPins/HiPins.js
CHANGED
@@ -10,7 +10,7 @@ export const styles = theme => ({
|
|
10
10
|
display: 'inline-block',
|
11
11
|
padding: '0 9px',
|
12
12
|
height: 16,
|
13
|
-
lineHeight: '
|
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,
|
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
|
62
|
+
color: PropTypes.string,
|
63
63
|
onClick: PropTypes.func
|
64
64
|
} : {};
|
65
65
|
export default withStyles(styles, { withTheme: true, name: 'HmuiHiPins' })(HiPins);
|
package/es/HiSelect/HiSelect.js
CHANGED
@@ -206,6 +206,7 @@ class HiSelect extends React.PureComponent {
|
|
206
206
|
classes,
|
207
207
|
disabled,
|
208
208
|
error,
|
209
|
+
loading,
|
209
210
|
options,
|
210
211
|
checkbox,
|
211
212
|
searchable,
|
@@ -222,24 +223,38 @@ class HiSelect extends React.PureComponent {
|
|
222
223
|
id,
|
223
224
|
placeholder,
|
224
225
|
staticPosition,
|
225
|
-
pinnedItem
|
226
|
+
pinnedItem,
|
227
|
+
hasAll
|
226
228
|
} = this.props;
|
227
229
|
|
228
|
-
const { open, suggestions, focused } = this.state;
|
230
|
+
const { open, suggestions, focused, dynamic } = this.state;
|
229
231
|
|
230
232
|
let display = '';
|
231
233
|
const selectedIdList = Array.isArray(value) ? value : value ? [value] : [];
|
232
234
|
|
233
235
|
let _suggestions = [...suggestions];
|
236
|
+
|
234
237
|
if (pinnedItem) {
|
235
|
-
_suggestions
|
238
|
+
_suggestions.unshift(pinnedItem);
|
236
239
|
}
|
237
240
|
|
238
|
-
|
241
|
+
// If loading
|
242
|
+
if (loading) {
|
243
|
+
_suggestions.unshift({
|
244
|
+
id: '_loading',
|
245
|
+
type: 'loader',
|
246
|
+
disabled: true,
|
247
|
+
centered: true,
|
248
|
+
checkbox: false,
|
249
|
+
label: 'loading'
|
250
|
+
});
|
251
|
+
}
|
252
|
+
|
253
|
+
if ((dynamic || loading) && selectedIdList.length === 1) {
|
239
254
|
display = translations.one_item_selected.replace('%s', selectedIdList.length);
|
240
|
-
} else if (this.state.nbOptions !== selectedIdList.length && selectedIdList.length > 1) {
|
255
|
+
} else if ((this.state.nbOptions !== selectedIdList.length || !hasAll) && selectedIdList.length > 1) {
|
241
256
|
display = translations.n_items_selected.replace('%s', selectedIdList.length);
|
242
|
-
} else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions
|
257
|
+
} else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions > 1) {
|
243
258
|
display = translations.all;
|
244
259
|
} else if (selectedIdList.length === 1) {
|
245
260
|
if (type !== 'icon') {
|
@@ -715,6 +730,10 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
715
730
|
* id du select
|
716
731
|
*/
|
717
732
|
id: PropTypes.string,
|
733
|
+
/**
|
734
|
+
* Ajoute un loader
|
735
|
+
*/
|
736
|
+
loading: PropTypes.bool,
|
718
737
|
/**
|
719
738
|
* Autorise la sélection de plusieurs valeurs
|
720
739
|
*/
|
@@ -134,6 +134,7 @@ class HiSuggestSelect extends React.PureComponent {
|
|
134
134
|
label: showNoResults ? translations.no_result_match : translations.min_length
|
135
135
|
}];
|
136
136
|
}
|
137
|
+
|
137
138
|
const open = !!optionsShown.length && focused;
|
138
139
|
|
139
140
|
return React.createElement(
|
@@ -196,7 +197,7 @@ HiSuggestSelect.defaultProps = {
|
|
196
197
|
showMinLength: false,
|
197
198
|
showNoResults: false,
|
198
199
|
translations: {
|
199
|
-
no_result_match: '
|
200
|
+
no_result_match: 'Aucun résultat correspondant',
|
200
201
|
min_length: 'Veuillez saisir 3 caractères minimum'
|
201
202
|
},
|
202
203
|
options: []
|
@@ -14,7 +14,8 @@ export const styles = theme => ({
|
|
14
14
|
width: '100%',
|
15
15
|
height: 40,
|
16
16
|
maxWidth: 500,
|
17
|
-
|
17
|
+
display: 'flex',
|
18
|
+
justifyContent: 'center',
|
18
19
|
padding: 8,
|
19
20
|
cursor: 'pointer'
|
20
21
|
},
|
@@ -89,18 +90,12 @@ export const styles = theme => ({
|
|
89
90
|
label: _extends({
|
90
91
|
whiteSpace: 'nowrap',
|
91
92
|
overflow: 'hidden',
|
92
|
-
textOverflow: 'ellipsis'
|
93
|
-
paddingRight: 16
|
93
|
+
textOverflow: 'ellipsis'
|
94
94
|
}, theme.typography.body1, {
|
95
95
|
display: 'inline-flex',
|
96
96
|
width: '100%'
|
97
97
|
}),
|
98
98
|
icon: {
|
99
|
-
position: 'absolute',
|
100
|
-
display: 'flex',
|
101
|
-
alignItems: 'center',
|
102
|
-
right: 0,
|
103
|
-
height: 40,
|
104
99
|
transition: theme.transitions.create(['opacity', 'transform'], {
|
105
100
|
duration: theme.transitions.duration.shorter
|
106
101
|
})
|