@hipay/hipay-material-ui 2.0.0-beta.53 → 2.0.0-beta.54
Sign up to get free protection for your applications and to get access to all the features.
- package/HiCell/CellSentinel.js +33 -109
- package/HiCell/CellSentinelScore.js +100 -0
- package/HiChip/HiChip.js +1 -1
- package/HiColoredLabel/HiColoredLabel.js +14 -4
- package/HiDatePicker/HiDatePicker.js +1 -1
- package/HiDatePicker/HiDateRangePicker.js +339 -420
- package/HiDatePicker/HiDateRangeSelector.js +81 -61
- package/HiDatePicker/NavBar.js +2 -1
- package/HiDatePicker/Overlays/TimePickerOverlay.js +1 -1
- package/HiDatePicker/Overlays/YearPickerOverlay.js +3 -3
- package/HiForm/HiFormControl.js +5 -4
- package/HiSelectNew/HiSelect.js +4 -1
- package/HiSwitch/HiSwitch.js +2 -1
- package/HiTable/HiCellBuilder.js +14 -7
- package/HiTable/constants.js +7 -5
- package/es/HiCell/CellSentinel.js +32 -108
- package/es/HiCell/CellSentinelScore.js +60 -0
- package/es/HiChip/HiChip.js +1 -1
- package/es/HiColoredLabel/HiColoredLabel.js +14 -3
- package/es/HiDatePicker/HiDatePicker.js +1 -1
- package/es/HiDatePicker/HiDateRangePicker.js +304 -364
- package/es/HiDatePicker/HiDateRangeSelector.js +71 -55
- package/es/HiDatePicker/NavBar.js +2 -1
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +1 -1
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +3 -3
- package/es/HiForm/HiFormControl.js +5 -4
- package/es/HiSelectNew/HiSelect.js +4 -1
- package/es/HiSwitch/HiSwitch.js +2 -1
- package/es/HiTable/HiCellBuilder.js +13 -7
- package/es/HiTable/constants.js +8 -1
- package/es/styles/createPalette.js +3 -3
- package/package.json +2 -2
- package/styles/createPalette.js +3 -3
- package/umd/hipay-material-ui.development.js +899 -1131
- package/umd/hipay-material-ui.production.min.js +1 -1
- package/yarn-error.log +0 -110
@@ -4,10 +4,10 @@
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('@hipay/hipay-material-ui/HiCell/CellAddress'), require('@hipay/hipay-material-ui/HiCell/CellDate'), require('@hipay/hipay-material-ui/HiCell/CellIcon'), require('@hipay/hipay-material-ui/HiCell/CellImage'), require('@hipay/hipay-material-ui/HiCell/CellNumeric'), require('@hipay/hipay-material-ui/HiCell/CellSentinel'), require('@hipay/hipay-material-ui/HiCell/CellText'), require('@hipay/hipay-material-ui/HiCell/CellRate'), require('@hipay/hipay-material-ui/HiCell/CellPinToAction')) :
|
8
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', '@hipay/hipay-material-ui/HiCell/CellAddress', '@hipay/hipay-material-ui/HiCell/CellDate', '@hipay/hipay-material-ui/HiCell/CellIcon', '@hipay/hipay-material-ui/HiCell/CellImage', '@hipay/hipay-material-ui/HiCell/CellNumeric', '@hipay/hipay-material-ui/HiCell/CellSentinel', '@hipay/hipay-material-ui/HiCell/CellText', '@hipay/hipay-material-ui/HiCell/CellRate', '@hipay/hipay-material-ui/HiCell/CellPinToAction'], factory) :
|
9
|
-
(factory((global['hipay-material-ui'] = {}),global.React,global.ReactDOM,global.CellAddress,global.CellDate,global.CellIcon,global.CellImage,global.CellNumeric,global.CellSentinel,global.CellText,global.CellRate,global.CellPinToAction));
|
10
|
-
}(this, (function (exports,React,require$$11,CellAddress,CellDate,CellIcon,CellImage,CellNumeric,CellSentinel,CellText,CellRate,CellPinToAction) { 'use strict';
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('@hipay/hipay-material-ui/HiCell/CellAddress'), require('@hipay/hipay-material-ui/HiCell/CellDate'), require('@hipay/hipay-material-ui/HiCell/CellIcon'), require('@hipay/hipay-material-ui/HiCell/CellImage'), require('@hipay/hipay-material-ui/HiCell/CellNumeric'), require('@hipay/hipay-material-ui/HiCell/CellSentinel'), require('@hipay/hipay-material-ui/HiCell/CellSentinelScore'), require('@hipay/hipay-material-ui/HiCell/CellText'), require('@hipay/hipay-material-ui/HiCell/CellRate'), require('@hipay/hipay-material-ui/HiCell/CellPinToAction')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', '@hipay/hipay-material-ui/HiCell/CellAddress', '@hipay/hipay-material-ui/HiCell/CellDate', '@hipay/hipay-material-ui/HiCell/CellIcon', '@hipay/hipay-material-ui/HiCell/CellImage', '@hipay/hipay-material-ui/HiCell/CellNumeric', '@hipay/hipay-material-ui/HiCell/CellSentinel', '@hipay/hipay-material-ui/HiCell/CellSentinelScore', '@hipay/hipay-material-ui/HiCell/CellText', '@hipay/hipay-material-ui/HiCell/CellRate', '@hipay/hipay-material-ui/HiCell/CellPinToAction'], factory) :
|
9
|
+
(factory((global['hipay-material-ui'] = {}),global.React,global.ReactDOM,global.CellAddress,global.CellDate,global.CellIcon,global.CellImage,global.CellNumeric,global.CellSentinel,global.CellSentinelScore,global.CellText,global.CellRate,global.CellPinToAction));
|
10
|
+
}(this, (function (exports,React,require$$11,CellAddress,CellDate,CellIcon,CellImage,CellNumeric,CellSentinel,CellSentinelScore,CellText,CellRate,CellPinToAction) { 'use strict';
|
11
11
|
|
12
12
|
var React__default = 'default' in React ? React['default'] : React;
|
13
13
|
var require$$11__default = 'default' in require$$11 ? require$$11['default'] : require$$11;
|
@@ -17,6 +17,7 @@
|
|
17
17
|
CellImage = CellImage && CellImage.hasOwnProperty('default') ? CellImage['default'] : CellImage;
|
18
18
|
CellNumeric = CellNumeric && CellNumeric.hasOwnProperty('default') ? CellNumeric['default'] : CellNumeric;
|
19
19
|
CellSentinel = CellSentinel && CellSentinel.hasOwnProperty('default') ? CellSentinel['default'] : CellSentinel;
|
20
|
+
CellSentinelScore = CellSentinelScore && CellSentinelScore.hasOwnProperty('default') ? CellSentinelScore['default'] : CellSentinelScore;
|
20
21
|
CellText = CellText && CellText.hasOwnProperty('default') ? CellText['default'] : CellText;
|
21
22
|
CellRate = CellRate && CellRate.hasOwnProperty('default') ? CellRate['default'] : CellRate;
|
22
23
|
CellPinToAction = CellPinToAction && CellPinToAction.hasOwnProperty('default') ? CellPinToAction['default'] : CellPinToAction;
|
@@ -1072,7 +1073,7 @@
|
|
1072
1073
|
} : _palette$primary,
|
1073
1074
|
_palette$secondary = palette.secondary,
|
1074
1075
|
secondary = _palette$secondary === void 0 ? {
|
1075
|
-
light: '#
|
1076
|
+
light: '#ffd94f',
|
1076
1077
|
main: '#ffcf21',
|
1077
1078
|
dark: '#E9BE30',
|
1078
1079
|
contrastText: '#FFFFFF'
|
@@ -1121,7 +1122,7 @@
|
|
1121
1122
|
_palette$type = palette.type,
|
1122
1123
|
type = _palette$type === void 0 ? 'light' : _palette$type,
|
1123
1124
|
_palette$contrastThre = palette.contrastThreshold,
|
1124
|
-
contrastThreshold = _palette$contrastThre === void 0 ? 2.
|
1125
|
+
contrastThreshold = _palette$contrastThre === void 0 ? 2.2 : _palette$contrastThre,
|
1125
1126
|
_palette$tonalOffset = palette.tonalOffset,
|
1126
1127
|
tonalOffset = _palette$tonalOffset === void 0 ? 0.2 : _palette$tonalOffset,
|
1127
1128
|
_palette$context = palette.context,
|
@@ -1136,7 +1137,7 @@
|
|
1136
1137
|
|
1137
1138
|
{
|
1138
1139
|
var contrast = getContrastRatio(background, contrastText);
|
1139
|
-
warning_1(contrast >= 2.
|
1140
|
+
warning_1(contrast >= 2.2, ["Material-UI: the contrast ratio of ".concat(contrast, ":1 for ").concat(contrastText, " on ").concat(background), 'falls below the WACG recommended absolute minimum contrast ratio of 3:1.', 'https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast'].join('\n'));
|
1140
1141
|
}
|
1141
1142
|
|
1142
1143
|
return contrastText;
|
@@ -15058,25 +15059,6 @@
|
|
15058
15059
|
function escapeHTML(unsafeStr) {
|
15059
15060
|
return unsafeStr.replace(/<br\/?>/g, '[br]').replace(/<strong>/g, '[[').replace(/<\/?strong>/g, ']]').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\[\[/g, '<strong>').replace(/\]\]/g, '</strong>').replace(/\[br\]/g, '<br>');
|
15060
15061
|
}
|
15061
|
-
/**
|
15062
|
-
* Remove duplicate items from array useful after concat arrays
|
15063
|
-
*
|
15064
|
-
* arrayUnique(array1.concat(array2))
|
15065
|
-
*
|
15066
|
-
* @param array
|
15067
|
-
*/
|
15068
|
-
|
15069
|
-
function arrayUnique(array) {
|
15070
|
-
var a = toConsumableArray(array);
|
15071
|
-
|
15072
|
-
for (var i = 0; i < a.length; i + 1) {
|
15073
|
-
for (var j = i + 1; j < a.length; j + 1) {
|
15074
|
-
if (a[i] === a[j]) a.splice(j - 1, 1);
|
15075
|
-
}
|
15076
|
-
}
|
15077
|
-
|
15078
|
-
return a;
|
15079
|
-
}
|
15080
15062
|
/**
|
15081
15063
|
* Retourne l'item selectionnable suivant.
|
15082
15064
|
* @param node
|
@@ -66296,7 +66278,7 @@
|
|
66296
66278
|
position: 'relative',
|
66297
66279
|
cursor: 'pointer',
|
66298
66280
|
'&:hover, &:focus': {
|
66299
|
-
color: theme.palette.
|
66281
|
+
color: theme.palette.neutral.dark
|
66300
66282
|
}
|
66301
66283
|
},
|
66302
66284
|
label: {
|
@@ -73705,6 +73687,7 @@
|
|
73705
73687
|
position: 'absolute',
|
73706
73688
|
right: 5,
|
73707
73689
|
cursor: 'pointer',
|
73690
|
+
zIndex: 1,
|
73708
73691
|
top: '-5px',
|
73709
73692
|
'&$iconButtonError': {
|
73710
73693
|
color: theme.palette.negative.main
|
@@ -73889,7 +73872,7 @@
|
|
73889
73872
|
required: required,
|
73890
73873
|
disabled: disabled,
|
73891
73874
|
focused: !disabled && (focused || hovered)
|
73892
|
-
}, InputLabelProps), error && React__default.createElement(HiIconButton$1, {
|
73875
|
+
}, InputLabelProps), error && errorText && React__default.createElement(HiIconButton$1, {
|
73893
73876
|
className: classnames(classes.iconButton, classes.iconButtonError),
|
73894
73877
|
onClick: this.handleHelperClick,
|
73895
73878
|
onKeyDown: this.handleKeyDown
|
@@ -73922,8 +73905,8 @@
|
|
73922
73905
|
required: true,
|
73923
73906
|
disabled: false,
|
73924
73907
|
error: false,
|
73925
|
-
errorText:
|
73926
|
-
helperText:
|
73908
|
+
errorText: undefined,
|
73909
|
+
helperText: undefined,
|
73927
73910
|
helperIcon: false,
|
73928
73911
|
multiline: false,
|
73929
73912
|
nbChars: 0,
|
@@ -73958,7 +73941,7 @@
|
|
73958
73941
|
/**
|
73959
73942
|
* Texte de l'erreur
|
73960
73943
|
*/
|
73961
|
-
errorText: propTypes.string,
|
73944
|
+
errorText: propTypes.oneOfType([propTypes.string, propTypes.bool]),
|
73962
73945
|
|
73963
73946
|
/**
|
73964
73947
|
* Propriétés appliquées au composant FormHelperText
|
@@ -74494,7 +74477,8 @@
|
|
74494
74477
|
display: 'inline-flex',
|
74495
74478
|
width: 62,
|
74496
74479
|
position: 'relative',
|
74497
|
-
flexShrink: 0
|
74480
|
+
flexShrink: 0,
|
74481
|
+
zIndex: 0
|
74498
74482
|
},
|
74499
74483
|
bar: {
|
74500
74484
|
borderRadius: 7,
|
@@ -79938,7 +79922,7 @@
|
|
79938
79922
|
|
79939
79923
|
var TableSortLabel$2 = unwrapExports(TableSortLabel$1);
|
79940
79924
|
|
79941
|
-
var _TYPE_ACCOUNT, _TYPE_ACCOUNT_NUMBER, _TYPE_ADDRESS, _TYPE_CHECKBOX, _TYPE_COUNTRY, _TYPE_DATE, _TYPE_ICON, _TYPE_IMAGE, _TYPE_NUMERIC, _TYPE_RATE, _TYPE_SENTINEL, _TYPE_STATUS, _TYPE_TEXT, _TYPE_THIRD_PARTY_SEC, _DEFAULT_WIDTHS, _DEFAULT_VIEWS, _DEFAULT_PADDING;
|
79925
|
+
var _TYPE_ACCOUNT, _TYPE_ACCOUNT_NUMBER, _TYPE_ADDRESS, _TYPE_CHECKBOX, _TYPE_COUNTRY, _TYPE_DATE, _TYPE_ICON, _TYPE_IMAGE, _TYPE_NUMERIC, _TYPE_RATE, _TYPE_SENTINEL, _TYPE_SENTINEL_SCORE, _TYPE_STATUS, _TYPE_TEXT, _TYPE_THIRD_PARTY_SEC, _DEFAULT_WIDTHS, _DEFAULT_VIEWS, _DEFAULT_PADDING;
|
79942
79926
|
/**
|
79943
79927
|
* Cell height (px)
|
79944
79928
|
*/
|
@@ -79962,6 +79946,7 @@
|
|
79962
79946
|
var TYPE_NUMERIC = 'numeric';
|
79963
79947
|
var TYPE_RATE = 'rate';
|
79964
79948
|
var TYPE_SENTINEL = 'sentinel';
|
79949
|
+
var TYPE_SENTINEL_SCORE = 'sentinel_score';
|
79965
79950
|
var TYPE_STATUS = 'status';
|
79966
79951
|
var TYPE_COUNTRY = 'country';
|
79967
79952
|
var TYPE_TEXT = 'text';
|
@@ -79981,13 +79966,13 @@
|
|
79981
79966
|
* @type {{}}
|
79982
79967
|
*/
|
79983
79968
|
|
79984
|
-
var DEFAULT_WIDTHS = (_DEFAULT_WIDTHS = {}, defineProperty(_DEFAULT_WIDTHS, TYPE_ACCOUNT, (_TYPE_ACCOUNT = {}, defineProperty(_TYPE_ACCOUNT, VIEWS.LARGE, 160), defineProperty(_TYPE_ACCOUNT, VIEWS.MEDIUM, 120), defineProperty(_TYPE_ACCOUNT, VIEWS.SMALL, 80), _TYPE_ACCOUNT)), defineProperty(_DEFAULT_WIDTHS, TYPE_ACCOUNT_NUMBER, (_TYPE_ACCOUNT_NUMBER = {}, defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.LARGE, 100), defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.MEDIUM, 80), defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.SMALL, 60), _TYPE_ACCOUNT_NUMBER)), defineProperty(_DEFAULT_WIDTHS, TYPE_ADDRESS, (_TYPE_ADDRESS = {}, defineProperty(_TYPE_ADDRESS, VIEWS.LARGE, 120), defineProperty(_TYPE_ADDRESS, VIEWS.MEDIUM, 100), defineProperty(_TYPE_ADDRESS, VIEWS.SMALL, 80), _TYPE_ADDRESS)), defineProperty(_DEFAULT_WIDTHS, TYPE_CHECKBOX, (_TYPE_CHECKBOX = {}, defineProperty(_TYPE_CHECKBOX, VIEWS.LARGE, 40), defineProperty(_TYPE_CHECKBOX, VIEWS.MEDIUM, 40), defineProperty(_TYPE_CHECKBOX, VIEWS.SMALL, 40), _TYPE_CHECKBOX)), defineProperty(_DEFAULT_WIDTHS, TYPE_COUNTRY, (_TYPE_COUNTRY = {}, defineProperty(_TYPE_COUNTRY, VIEWS.LARGE, 120), defineProperty(_TYPE_COUNTRY, VIEWS.MEDIUM, 80), defineProperty(_TYPE_COUNTRY, VIEWS.SMALL, 40), _TYPE_COUNTRY)), defineProperty(_DEFAULT_WIDTHS, TYPE_DATE, (_TYPE_DATE = {}, defineProperty(_TYPE_DATE, VIEWS.LARGE, 220), defineProperty(_TYPE_DATE, VIEWS.MEDIUM, 140), defineProperty(_TYPE_DATE, VIEWS.SMALL, 120), _TYPE_DATE)), defineProperty(_DEFAULT_WIDTHS, TYPE_ICON, (_TYPE_ICON = {}, defineProperty(_TYPE_ICON, VIEWS.LARGE, 140), defineProperty(_TYPE_ICON, VIEWS.MEDIUM, 100), defineProperty(_TYPE_ICON, VIEWS.SMALL, 60), _TYPE_ICON)), defineProperty(_DEFAULT_WIDTHS, TYPE_IMAGE, (_TYPE_IMAGE = {}, defineProperty(_TYPE_IMAGE, VIEWS.LARGE, 140), defineProperty(_TYPE_IMAGE, VIEWS.MEDIUM, 100), defineProperty(_TYPE_IMAGE, VIEWS.SMALL, 60), _TYPE_IMAGE)), defineProperty(_DEFAULT_WIDTHS, TYPE_NUMERIC, (_TYPE_NUMERIC = {}, defineProperty(_TYPE_NUMERIC, VIEWS.LARGE, 120), defineProperty(_TYPE_NUMERIC, VIEWS.MEDIUM, 100), defineProperty(_TYPE_NUMERIC, VIEWS.SMALL, 80), _TYPE_NUMERIC)), defineProperty(_DEFAULT_WIDTHS, TYPE_RATE, (_TYPE_RATE = {}, defineProperty(_TYPE_RATE, VIEWS.LARGE, 100), defineProperty(_TYPE_RATE, VIEWS.MEDIUM, 90), defineProperty(_TYPE_RATE, VIEWS.SMALL, 80), _TYPE_RATE)), defineProperty(_DEFAULT_WIDTHS, TYPE_SENTINEL, (_TYPE_SENTINEL = {}, defineProperty(_TYPE_SENTINEL, VIEWS.LARGE,
|
79969
|
+
var DEFAULT_WIDTHS = (_DEFAULT_WIDTHS = {}, defineProperty(_DEFAULT_WIDTHS, TYPE_ACCOUNT, (_TYPE_ACCOUNT = {}, defineProperty(_TYPE_ACCOUNT, VIEWS.LARGE, 160), defineProperty(_TYPE_ACCOUNT, VIEWS.MEDIUM, 120), defineProperty(_TYPE_ACCOUNT, VIEWS.SMALL, 80), _TYPE_ACCOUNT)), defineProperty(_DEFAULT_WIDTHS, TYPE_ACCOUNT_NUMBER, (_TYPE_ACCOUNT_NUMBER = {}, defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.LARGE, 100), defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.MEDIUM, 80), defineProperty(_TYPE_ACCOUNT_NUMBER, VIEWS.SMALL, 60), _TYPE_ACCOUNT_NUMBER)), defineProperty(_DEFAULT_WIDTHS, TYPE_ADDRESS, (_TYPE_ADDRESS = {}, defineProperty(_TYPE_ADDRESS, VIEWS.LARGE, 120), defineProperty(_TYPE_ADDRESS, VIEWS.MEDIUM, 100), defineProperty(_TYPE_ADDRESS, VIEWS.SMALL, 80), _TYPE_ADDRESS)), defineProperty(_DEFAULT_WIDTHS, TYPE_CHECKBOX, (_TYPE_CHECKBOX = {}, defineProperty(_TYPE_CHECKBOX, VIEWS.LARGE, 40), defineProperty(_TYPE_CHECKBOX, VIEWS.MEDIUM, 40), defineProperty(_TYPE_CHECKBOX, VIEWS.SMALL, 40), _TYPE_CHECKBOX)), defineProperty(_DEFAULT_WIDTHS, TYPE_COUNTRY, (_TYPE_COUNTRY = {}, defineProperty(_TYPE_COUNTRY, VIEWS.LARGE, 120), defineProperty(_TYPE_COUNTRY, VIEWS.MEDIUM, 80), defineProperty(_TYPE_COUNTRY, VIEWS.SMALL, 40), _TYPE_COUNTRY)), defineProperty(_DEFAULT_WIDTHS, TYPE_DATE, (_TYPE_DATE = {}, defineProperty(_TYPE_DATE, VIEWS.LARGE, 220), defineProperty(_TYPE_DATE, VIEWS.MEDIUM, 140), defineProperty(_TYPE_DATE, VIEWS.SMALL, 120), _TYPE_DATE)), defineProperty(_DEFAULT_WIDTHS, TYPE_ICON, (_TYPE_ICON = {}, defineProperty(_TYPE_ICON, VIEWS.LARGE, 140), defineProperty(_TYPE_ICON, VIEWS.MEDIUM, 100), defineProperty(_TYPE_ICON, VIEWS.SMALL, 60), _TYPE_ICON)), defineProperty(_DEFAULT_WIDTHS, TYPE_IMAGE, (_TYPE_IMAGE = {}, defineProperty(_TYPE_IMAGE, VIEWS.LARGE, 140), defineProperty(_TYPE_IMAGE, VIEWS.MEDIUM, 100), defineProperty(_TYPE_IMAGE, VIEWS.SMALL, 60), _TYPE_IMAGE)), defineProperty(_DEFAULT_WIDTHS, TYPE_NUMERIC, (_TYPE_NUMERIC = {}, defineProperty(_TYPE_NUMERIC, VIEWS.LARGE, 120), defineProperty(_TYPE_NUMERIC, VIEWS.MEDIUM, 100), defineProperty(_TYPE_NUMERIC, VIEWS.SMALL, 80), _TYPE_NUMERIC)), defineProperty(_DEFAULT_WIDTHS, TYPE_RATE, (_TYPE_RATE = {}, defineProperty(_TYPE_RATE, VIEWS.LARGE, 100), defineProperty(_TYPE_RATE, VIEWS.MEDIUM, 90), defineProperty(_TYPE_RATE, VIEWS.SMALL, 80), _TYPE_RATE)), defineProperty(_DEFAULT_WIDTHS, TYPE_SENTINEL, (_TYPE_SENTINEL = {}, defineProperty(_TYPE_SENTINEL, VIEWS.LARGE, 64), defineProperty(_TYPE_SENTINEL, VIEWS.MEDIUM, 64), defineProperty(_TYPE_SENTINEL, VIEWS.SMALL, 64), _TYPE_SENTINEL)), defineProperty(_DEFAULT_WIDTHS, TYPE_SENTINEL_SCORE, (_TYPE_SENTINEL_SCORE = {}, defineProperty(_TYPE_SENTINEL_SCORE, VIEWS.LARGE, 80), defineProperty(_TYPE_SENTINEL_SCORE, VIEWS.MEDIUM, 80), defineProperty(_TYPE_SENTINEL_SCORE, VIEWS.SMALL, 80), _TYPE_SENTINEL_SCORE)), defineProperty(_DEFAULT_WIDTHS, TYPE_STATUS, (_TYPE_STATUS = {}, defineProperty(_TYPE_STATUS, VIEWS.LARGE, 120), defineProperty(_TYPE_STATUS, VIEWS.MEDIUM, 100), defineProperty(_TYPE_STATUS, VIEWS.SMALL, 80), _TYPE_STATUS)), defineProperty(_DEFAULT_WIDTHS, TYPE_TEXT, (_TYPE_TEXT = {}, defineProperty(_TYPE_TEXT, VIEWS.LARGE, 200), defineProperty(_TYPE_TEXT, VIEWS.MEDIUM, 120), defineProperty(_TYPE_TEXT, VIEWS.SMALL, 80), _TYPE_TEXT)), defineProperty(_DEFAULT_WIDTHS, TYPE_THIRD_PARTY_SECURITY, (_TYPE_THIRD_PARTY_SEC = {}, defineProperty(_TYPE_THIRD_PARTY_SEC, VIEWS.LARGE, 40), defineProperty(_TYPE_THIRD_PARTY_SEC, VIEWS.MEDIUM, 40), defineProperty(_TYPE_THIRD_PARTY_SEC, VIEWS.SMALL, 40), _TYPE_THIRD_PARTY_SEC)), _DEFAULT_WIDTHS);
|
79985
79970
|
/**
|
79986
79971
|
* Cell default width for each views
|
79987
79972
|
* @type {{}}
|
79988
79973
|
*/
|
79989
79974
|
|
79990
|
-
var DEFAULT_VIEWS = (_DEFAULT_VIEWS = {}, defineProperty(_DEFAULT_VIEWS, TYPE_ACCOUNT, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ACCOUNT_NUMBER, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ADDRESS, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_CHECKBOX, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_COUNTRY, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_DATE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ICON, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_IMAGE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_NUMERIC, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_RATE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_SENTINEL, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_STATUS, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_TEXT, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_THIRD_PARTY_SECURITY, VIEWS.LARGE), _DEFAULT_VIEWS);
|
79975
|
+
var DEFAULT_VIEWS = (_DEFAULT_VIEWS = {}, defineProperty(_DEFAULT_VIEWS, TYPE_ACCOUNT, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ACCOUNT_NUMBER, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ADDRESS, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_CHECKBOX, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_COUNTRY, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_DATE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_ICON, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_IMAGE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_NUMERIC, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_RATE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_SENTINEL, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_SENTINEL_SCORE, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_STATUS, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_TEXT, VIEWS.LARGE), defineProperty(_DEFAULT_VIEWS, TYPE_THIRD_PARTY_SECURITY, VIEWS.LARGE), _DEFAULT_VIEWS);
|
79991
79976
|
/**
|
79992
79977
|
* Cell default side padding (one side) for each views
|
79993
79978
|
* @type {{}}
|
@@ -79999,7 +79984,7 @@
|
|
79999
79984
|
* @type {*[]}
|
80000
79985
|
*/
|
80001
79986
|
|
80002
|
-
var ALIGN_RIGHT_TYPES = [TYPE_NUMERIC, TYPE_RATE, TYPE_SENTINEL];
|
79987
|
+
var ALIGN_RIGHT_TYPES = [TYPE_NUMERIC, TYPE_RATE, TYPE_SENTINEL, TYPE_SENTINEL_SCORE];
|
80003
79988
|
|
80004
79989
|
var styles$c = function styles(theme) {
|
80005
79990
|
return {
|
@@ -80347,13 +80332,18 @@
|
|
80347
80332
|
|
80348
80333
|
case TYPE_SENTINEL:
|
80349
80334
|
return React__default.createElement(CellSentinel, {
|
80350
|
-
|
80351
|
-
|
80352
|
-
|
80353
|
-
|
80354
|
-
|
80355
|
-
|
80356
|
-
|
80335
|
+
color: datacell.color,
|
80336
|
+
label: datacell.label,
|
80337
|
+
letter: datacell.label2,
|
80338
|
+
active: datacell.active,
|
80339
|
+
reviewer: datacell.reviewer,
|
80340
|
+
outlined: datacell.outlined
|
80341
|
+
});
|
80342
|
+
|
80343
|
+
case TYPE_SENTINEL_SCORE:
|
80344
|
+
return React__default.createElement(CellSentinelScore, {
|
80345
|
+
value: datacell.value,
|
80346
|
+
result: datacell.result
|
80357
80347
|
});
|
80358
80348
|
|
80359
80349
|
case TYPE_PIN_TO_ACTION:
|
@@ -91180,7 +91170,7 @@
|
|
91180
91170
|
bottom: 0,
|
91181
91171
|
height: 32,
|
91182
91172
|
width: 32,
|
91183
|
-
margin: '
|
91173
|
+
margin: '0px 24px'
|
91184
91174
|
},
|
91185
91175
|
calendarButton: {
|
91186
91176
|
fontWeight: theme.typography.fontWeightMedium
|
@@ -91473,8 +91463,8 @@
|
|
91473
91463
|
}(React__default.Component);
|
91474
91464
|
|
91475
91465
|
YearPickerOverlay.defaultProps = {
|
91476
|
-
disableFutureDays:
|
91477
|
-
disablePastDays: false,
|
91466
|
+
// disableFutureDays: true,
|
91467
|
+
// disablePastDays: false,
|
91478
91468
|
minimumDate: new Date(2013, 4, 1),
|
91479
91469
|
// by default 1 May 2013
|
91480
91470
|
translations: {
|
@@ -91510,7 +91500,7 @@
|
|
91510
91500
|
/**
|
91511
91501
|
* Date minimale sélectionnable
|
91512
91502
|
*/
|
91513
|
-
minimumDate: propTypes.instanceOf(Date),
|
91503
|
+
minimumDate: propTypes.instanceOf(Date).isRequired,
|
91514
91504
|
|
91515
91505
|
/**
|
91516
91506
|
* Fonction de callback
|
@@ -91617,7 +91607,8 @@
|
|
91617
91607
|
button: {
|
91618
91608
|
height: 32,
|
91619
91609
|
width: 32,
|
91620
|
-
margin: '4px 24px'
|
91610
|
+
margin: '4px 24px',
|
91611
|
+
padding: 0
|
91621
91612
|
},
|
91622
91613
|
left: {
|
91623
91614
|
float: 'left'
|
@@ -92175,7 +92166,7 @@
|
|
92175
92166
|
todayButton: translations.today,
|
92176
92167
|
onTodayButtonClick: this.handleCurrentMonthChange,
|
92177
92168
|
weekdayElement: Weekday$1,
|
92178
|
-
|
92169
|
+
navbarElement: function navbarElement(props2) {
|
92179
92170
|
return React__default.createElement(NavBar$1, _extends_1({
|
92180
92171
|
showClockButton: enableTime,
|
92181
92172
|
onClockClick: _this2.handleClockClick
|
@@ -92484,400 +92475,288 @@
|
|
92484
92475
|
|
92485
92476
|
_this = possibleConstructorReturn(this, getPrototypeOf(HiDateRangePicker).call(this));
|
92486
92477
|
|
92487
|
-
_this.
|
92488
|
-
|
92489
|
-
|
92478
|
+
_this.handleDayChange = function (name, day) {
|
92479
|
+
if (day) {
|
92480
|
+
// if time disabled, focus TO input
|
92481
|
+
// else focus current input
|
92482
|
+
if (!_this.props.enableTime) {
|
92483
|
+
if (day instanceof Date) {
|
92484
|
+
if (name === 'from' && _this.toInput) {
|
92485
|
+
_this.toInput.getInput().focus();
|
92486
|
+
}
|
92487
|
+
}
|
92488
|
+
} else {
|
92489
|
+
_this.timeout = setTimeout(function () {
|
92490
|
+
if (_this["".concat(name, "Input")].getInput()) {
|
92491
|
+
_this["".concat(name, "Input")].getInput().focus();
|
92492
|
+
}
|
92493
|
+
}, 10);
|
92494
|
+
}
|
92490
92495
|
|
92491
|
-
_this.props.onChange
|
92492
|
-
|
92496
|
+
if (_this.props.onChange) {
|
92497
|
+
_this.handleChange(name, day);
|
92498
|
+
}
|
92499
|
+
|
92500
|
+
if (_this.props.enableTime) {
|
92501
|
+
_this.openPanel('time');
|
92502
|
+
}
|
92503
|
+
}
|
92493
92504
|
};
|
92494
92505
|
|
92495
|
-
_this.
|
92496
|
-
return function () {
|
92497
|
-
_this.
|
92498
|
-
focusedInput: name
|
92499
|
-
});
|
92506
|
+
_this.handleInputChange = function (inputName) {
|
92507
|
+
return function (event) {
|
92508
|
+
_this.handleChange(inputName, event.target.value);
|
92500
92509
|
};
|
92501
92510
|
};
|
92502
92511
|
|
92503
|
-
_this.
|
92504
|
-
|
92505
|
-
_this.setState({
|
92506
|
-
focusedInput: ''
|
92507
|
-
});
|
92512
|
+
_this.onDayToClick = function (day) {
|
92513
|
+
_this.handleDayChange('to', day);
|
92508
92514
|
|
92509
|
-
|
92510
|
-
_this.props.onBlur(name);
|
92511
|
-
}
|
92512
|
-
};
|
92515
|
+
document.activeElement.blur();
|
92513
92516
|
};
|
92514
92517
|
|
92515
|
-
_this.
|
92516
|
-
|
92517
|
-
toCurrentMonth: props.to ? props.to : new Date(),
|
92518
|
-
focusedInput: ''
|
92519
|
-
};
|
92520
|
-
_this.handleReset = _this.handleReset.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92521
|
-
_this.handleDayChange = _this.handleDayChange.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92522
|
-
_this.handleDayChangeFrom = _this.handleDayChangeFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92523
|
-
_this.handleDayChangeTo = _this.handleDayChangeTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92524
|
-
_this.handleCurrentMonthChange = _this.handleCurrentMonthChange.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92525
|
-
_this.handleCurrentMonthChangeFrom = _this.handleCurrentMonthChangeFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92526
|
-
_this.handleCurrentMonthChangeTo = _this.handleCurrentMonthChangeTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92527
|
-
_this.handleTimeChange = _this.handleTimeChange.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92528
|
-
_this.handleCalendarClick = _this.handleCalendarClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92529
|
-
_this.handleCalendarClickFrom = _this.handleCalendarClickFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92530
|
-
_this.handleCalendarClickTo = _this.handleCalendarClickTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92531
|
-
_this.handleClockClick = _this.handleClockClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92532
|
-
_this.handleClockClickFrom = _this.handleClockClickFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92533
|
-
_this.handleClockClickTo = _this.handleClockClickTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92534
|
-
_this.handleMonthClick = _this.handleMonthClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92535
|
-
_this.handleMonthClickFrom = _this.handleMonthClickFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92536
|
-
_this.handleMonthClickTo = _this.handleMonthClickTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92537
|
-
_this.handleYearClick = _this.handleYearClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92538
|
-
_this.handleYearClickFrom = _this.handleYearClickFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92539
|
-
_this.handleYearClickTo = _this.handleYearClickTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92540
|
-
_this.handleDayPickerFocus = _this.handleDayPickerFocus.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92541
|
-
_this.handleDayPickerBlur = _this.handleDayPickerBlur.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92542
|
-
_this.handleInputChange = _this.handleInputChange.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92543
|
-
_this.openPanel = _this.openPanel.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92544
|
-
_this.renderCaption = _this.renderCaption.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92545
|
-
_this.renderCaptionFrom = _this.renderCaptionFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92546
|
-
_this.renderCaptionTo = _this.renderCaptionTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92547
|
-
_this.renderNavBar = _this.renderNavBar.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92548
|
-
_this.renderNavBarFrom = _this.renderNavBarFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92549
|
-
_this.renderNavBarTo = _this.renderNavBarTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92550
|
-
_this.renderOverlay = _this.renderOverlay.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92551
|
-
_this.renderOverlayFrom = _this.renderOverlayFrom.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92552
|
-
_this.renderOverlayTo = _this.renderOverlayTo.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92553
|
-
_this.renderMonthPickerOverlay = _this.renderMonthPickerOverlay.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92554
|
-
_this.renderTimePickerOverlay = _this.renderTimePickerOverlay.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92555
|
-
_this.renderYearPickerOverlay = _this.renderYearPickerOverlay.bind(assertThisInitialized(assertThisInitialized(_this)));
|
92556
|
-
return _this;
|
92557
|
-
}
|
92518
|
+
_this.handleTimeChange = function (name, date, precision) {
|
92519
|
+
_this.handleChange(name, date);
|
92558
92520
|
|
92559
|
-
|
92560
|
-
|
92561
|
-
value: function componentDidUpdate(prevProps) {
|
92562
|
-
var _this2 = this;
|
92521
|
+
if (name === 'from' && precision === 'minute') {
|
92522
|
+
_this.fromInput.hideDayPicker();
|
92563
92523
|
|
92564
|
-
|
92565
|
-
|
92566
|
-
|
92567
|
-
|
92568
|
-
|
92569
|
-
|
92570
|
-
|
92524
|
+
_this.toInput.getInput().focus();
|
92525
|
+
|
92526
|
+
_this.toInput.showDayPicker();
|
92527
|
+
|
92528
|
+
_this.openPanel('calendar');
|
92529
|
+
} else if (name === 'to' && precision === 'minute') {
|
92530
|
+
_this.toInput.hideDayPicker();
|
92531
|
+
|
92532
|
+
document.activeElement.blur();
|
92571
92533
|
}
|
92572
|
-
}
|
92573
|
-
}, {
|
92574
|
-
key: "componentWillUnmount",
|
92575
|
-
value: function componentWillUnmount() {
|
92576
|
-
clearTimeout(this.timeout);
|
92577
|
-
}
|
92578
|
-
}, {
|
92579
|
-
key: "handleDayChange",
|
92580
|
-
value: function handleDayChange(name, day, modifiers) {
|
92581
|
-
var _this3 = this;
|
92534
|
+
};
|
92582
92535
|
|
92583
|
-
|
92584
|
-
|
92585
|
-
|
92586
|
-
|
92587
|
-
|
92588
|
-
|
92589
|
-
|
92590
|
-
|
92591
|
-
|
92592
|
-
// trigger blur only if user clicks on date into calendar
|
92593
|
-
// else keep focus to see day selection into calendar
|
92594
|
-
document.activeElement.blur();
|
92595
|
-
}
|
92536
|
+
_this.handleChange = function (name, day) {
|
92537
|
+
var translations = _this.props.translations;
|
92538
|
+
var date = undefined;
|
92539
|
+
var error = undefined;
|
92540
|
+
var now = new Date();
|
92541
|
+
var _this$props = _this.props,
|
92542
|
+
minimumDate = _this$props.minimumDate,
|
92543
|
+
disableFutureDays = _this$props.disableFutureDays,
|
92544
|
+
format = _this$props.format;
|
92596
92545
|
|
92597
|
-
|
92598
|
-
|
92599
|
-
|
92546
|
+
if (day instanceof Date) {
|
92547
|
+
date = day;
|
92548
|
+
} else if (day) {
|
92549
|
+
var parsedValue = moment(day, _this.props.format, true);
|
92550
|
+
|
92551
|
+
if (parsedValue.isValid()) {
|
92552
|
+
date = parsedValue.toDate();
|
92600
92553
|
} else {
|
92601
|
-
|
92602
|
-
if (_this3["".concat(name, "Input")].getInput()) {
|
92603
|
-
_this3["".concat(name, "Input")].getInput().focus();
|
92604
|
-
}
|
92605
|
-
}, 10);
|
92554
|
+
error = translations.invalid_format;
|
92606
92555
|
}
|
92556
|
+
}
|
92607
92557
|
|
92608
|
-
|
92609
|
-
|
92610
|
-
if (this.props.enableTime) {
|
92611
|
-
if (this.props[name]) {
|
92612
|
-
day.setHours(this.props[name].getHours(), this.props[name].getMinutes());
|
92613
|
-
} else {
|
92614
|
-
day.setHours(0, 0);
|
92615
|
-
}
|
92616
|
-
}
|
92558
|
+
if (date) {
|
92559
|
+
var comparativeDate = name === 'to' ? moment(_this.props.from) : moment(_this.props.to);
|
92617
92560
|
|
92618
|
-
|
92561
|
+
if (name === 'to' && comparativeDate > moment(date) || name === 'from' && comparativeDate < moment(date)) {
|
92562
|
+
error = translations.to_superior_from;
|
92563
|
+
} else if (date < minimumDate) {
|
92564
|
+
error = translations.date_inferior_min_date.replace("%s", moment(minimumDate).format(format));
|
92565
|
+
} else if (disableFutureDays && date > now) {
|
92566
|
+
error = translations.date_superior_max_date.replace("%s", moment().format(format));
|
92619
92567
|
}
|
92620
92568
|
|
92621
|
-
if (
|
92622
|
-
|
92569
|
+
if (!_this.props.enableTime) {
|
92570
|
+
if (name === 'from') {
|
92571
|
+
date.setHours(0, 0);
|
92572
|
+
} else {
|
92573
|
+
date.setHours(23, 59);
|
92574
|
+
}
|
92623
92575
|
}
|
92624
92576
|
}
|
92625
|
-
}
|
92626
|
-
}, {
|
92627
|
-
key: "handleDayChangeFrom",
|
92628
|
-
value: function handleDayChangeFrom(day, modifiers) {
|
92629
|
-
this.handleDayChange('from', day, modifiers);
|
92630
|
-
}
|
92631
|
-
}, {
|
92632
|
-
key: "handleDayChangeTo",
|
92633
|
-
value: function handleDayChangeTo(day, modifiers) {
|
92634
|
-
this.handleDayChange('to', day, modifiers);
|
92635
|
-
}
|
92636
|
-
}, {
|
92637
|
-
key: "handleCurrentMonthChange",
|
92638
|
-
value: function handleCurrentMonthChange(name, day) {
|
92639
|
-
var _this$setState;
|
92640
92577
|
|
92641
|
-
|
92642
|
-
}
|
92643
|
-
}, {
|
92644
|
-
key: "handleCurrentMonthChangeFrom",
|
92645
|
-
value: function handleCurrentMonthChangeFrom(day) {
|
92646
|
-
this.handleCurrentMonthChange('from', day);
|
92647
|
-
}
|
92648
|
-
}, {
|
92649
|
-
key: "handleCurrentMonthChangeTo",
|
92650
|
-
value: function handleCurrentMonthChangeTo(day) {
|
92651
|
-
this.handleCurrentMonthChange('to', day);
|
92652
|
-
}
|
92653
|
-
}, {
|
92654
|
-
key: "handleCalendarClick",
|
92655
|
-
value: function handleCalendarClick(name) {
|
92656
|
-
this.openPanel(name, 'calendar');
|
92657
|
-
}
|
92658
|
-
}, {
|
92659
|
-
key: "handleCalendarClickFrom",
|
92660
|
-
value: function handleCalendarClickFrom() {
|
92661
|
-
this.handleCalendarClick('from');
|
92662
|
-
}
|
92663
|
-
}, {
|
92664
|
-
key: "handleCalendarClickTo",
|
92665
|
-
value: function handleCalendarClickTo() {
|
92666
|
-
this.handleCalendarClick('to');
|
92667
|
-
}
|
92668
|
-
}, {
|
92669
|
-
key: "handleClockClick",
|
92670
|
-
value: function handleClockClick(name) {
|
92671
|
-
this.openPanel(name, 'time');
|
92672
|
-
}
|
92673
|
-
}, {
|
92674
|
-
key: "handleClockClickFrom",
|
92675
|
-
value: function handleClockClickFrom() {
|
92676
|
-
this.handleClockClick('from');
|
92677
|
-
}
|
92678
|
-
}, {
|
92679
|
-
key: "handleClockClickTo",
|
92680
|
-
value: function handleClockClickTo() {
|
92681
|
-
this.handleClockClick('to');
|
92682
|
-
}
|
92683
|
-
}, {
|
92684
|
-
key: "handleMonthClick",
|
92685
|
-
value: function handleMonthClick(name) {
|
92686
|
-
this.openPanel(name, 'months');
|
92687
|
-
}
|
92688
|
-
}, {
|
92689
|
-
key: "handleMonthClickFrom",
|
92690
|
-
value: function handleMonthClickFrom() {
|
92691
|
-
this.handleMonthClick('from');
|
92692
|
-
}
|
92693
|
-
}, {
|
92694
|
-
key: "handleMonthClickTo",
|
92695
|
-
value: function handleMonthClickTo() {
|
92696
|
-
this.handleMonthClick('to');
|
92697
|
-
}
|
92698
|
-
}, {
|
92699
|
-
key: "handleYearClick",
|
92700
|
-
value: function handleYearClick(name) {
|
92701
|
-
this.openPanel(name, 'years');
|
92702
|
-
}
|
92703
|
-
}, {
|
92704
|
-
key: "handleYearClickFrom",
|
92705
|
-
value: function handleYearClickFrom() {
|
92706
|
-
this.handleYearClick('from');
|
92707
|
-
}
|
92708
|
-
}, {
|
92709
|
-
key: "handleYearClickTo",
|
92710
|
-
value: function handleYearClickTo() {
|
92711
|
-
this.handleYearClick('to');
|
92712
|
-
}
|
92713
|
-
}, {
|
92714
|
-
key: "handleTimeChange",
|
92715
|
-
value: function handleTimeChange(name, date, precision) {
|
92716
|
-
this.props.onChange(name, date);
|
92578
|
+
_this.props.onChange(name, date);
|
92717
92579
|
|
92718
|
-
|
92719
|
-
|
92720
|
-
|
92721
|
-
|
92722
|
-
|
92723
|
-
|
92724
|
-
|
92580
|
+
_this.props.onChange("".concat(name, "Error"), error);
|
92581
|
+
};
|
92582
|
+
|
92583
|
+
_this.handleCurrentMonthChange = function (day) {
|
92584
|
+
_this.setState({
|
92585
|
+
currentMonth: day,
|
92586
|
+
openedPanel: 'calendar'
|
92587
|
+
});
|
92588
|
+
};
|
92589
|
+
|
92590
|
+
_this.handleDayPickerFocus = function (name) {
|
92591
|
+
_this.setState({
|
92592
|
+
focusedInput: name
|
92593
|
+
});
|
92594
|
+
};
|
92595
|
+
|
92596
|
+
_this.handleDayPickerBlur = function (name) {
|
92597
|
+
_this.setState({
|
92598
|
+
focusedInput: ''
|
92599
|
+
});
|
92600
|
+
|
92601
|
+
if (_this.props.onBlur) {
|
92602
|
+
_this.props.onBlur(name);
|
92725
92603
|
}
|
92726
|
-
}
|
92727
|
-
}, {
|
92728
|
-
key: "handleReset",
|
92729
|
-
value: function handleReset(name) {
|
92730
|
-
var _this4 = this;
|
92731
92604
|
|
92732
|
-
|
92733
|
-
|
92734
|
-
|
92735
|
-
|
92605
|
+
_this.timeout = setTimeout(function () {
|
92606
|
+
if (!['from', 'to'].includes(_this.state.focusedInput)) {
|
92607
|
+
_this.setState({
|
92608
|
+
openedPanel: 'calendar'
|
92609
|
+
});
|
92736
92610
|
}
|
92737
|
-
},
|
92738
|
-
}
|
92739
|
-
|
92740
|
-
|
92741
|
-
|
92742
|
-
|
92743
|
-
|
92744
|
-
|
92745
|
-
|
92746
|
-
|
92611
|
+
}, 100);
|
92612
|
+
};
|
92613
|
+
|
92614
|
+
_this.handleReset = function (name) {
|
92615
|
+
_this.handleChange(name, undefined);
|
92616
|
+
|
92617
|
+
_this.setState({
|
92618
|
+
keyFrom: _this.state.keyFrom === 1 ? 2 : 1,
|
92619
|
+
keyTo: _this.state.keyTo === 1 ? 2 : 1
|
92620
|
+
});
|
92621
|
+
};
|
92622
|
+
|
92623
|
+
_this.openPanel = function (panel) {
|
92624
|
+
_this.setState({
|
92625
|
+
openedPanel: panel
|
92626
|
+
});
|
92627
|
+
};
|
92628
|
+
|
92629
|
+
_this.renderCaption = function (propsCaption) {
|
92747
92630
|
return React__default.createElement(Caption$2, _extends_1({
|
92748
|
-
onMonthClick:
|
92749
|
-
|
92631
|
+
onMonthClick: function onMonthClick() {
|
92632
|
+
return _this.openPanel('months');
|
92633
|
+
},
|
92634
|
+
onYearClick: function onYearClick() {
|
92635
|
+
return _this.openPanel('years');
|
92636
|
+
}
|
92750
92637
|
}, propsCaption));
|
92751
|
-
}
|
92752
|
-
|
92753
|
-
|
92754
|
-
value: function renderCaptionFrom(propsCaption) {
|
92755
|
-
return this.renderCaption('from', propsCaption);
|
92756
|
-
}
|
92757
|
-
}, {
|
92758
|
-
key: "renderCaptionTo",
|
92759
|
-
value: function renderCaptionTo(propsCaption) {
|
92760
|
-
return this.renderCaption('to', propsCaption);
|
92761
|
-
}
|
92762
|
-
}, {
|
92763
|
-
key: "renderNavBar",
|
92764
|
-
value: function renderNavBar(name, propsNavBar) {
|
92638
|
+
};
|
92639
|
+
|
92640
|
+
_this.renderNavBar = function (propsNavBar) {
|
92765
92641
|
return React__default.createElement(NavBar$1, _extends_1({
|
92766
|
-
showClockButton:
|
92767
|
-
onClockClick:
|
92642
|
+
showClockButton: _this.props.enableTime,
|
92643
|
+
onClockClick: function onClockClick() {
|
92644
|
+
return _this.openPanel('time');
|
92645
|
+
}
|
92768
92646
|
}, propsNavBar));
|
92769
|
-
}
|
92770
|
-
|
92771
|
-
|
92772
|
-
value: function renderNavBarFrom(propsNavBar) {
|
92773
|
-
return this.renderNavBar('from', propsNavBar);
|
92774
|
-
}
|
92775
|
-
}, {
|
92776
|
-
key: "renderNavBarTo",
|
92777
|
-
value: function renderNavBarTo(propsNavBar) {
|
92778
|
-
return this.renderNavBar('to', propsNavBar);
|
92779
|
-
}
|
92780
|
-
}, {
|
92781
|
-
key: "renderOverlay",
|
92782
|
-
value: function renderOverlay(name, propsOverlay, staticPosition) {
|
92647
|
+
};
|
92648
|
+
|
92649
|
+
_this.renderOverlay = function (name, propsOverlay, staticPosition) {
|
92783
92650
|
var rangeOverlayProps = _extends_1({}, propsOverlay, {
|
92784
92651
|
side: name,
|
92785
92652
|
staticPosition: staticPosition
|
92786
92653
|
});
|
92787
92654
|
|
92788
|
-
switch (
|
92655
|
+
switch (_this.state['openedPanel']) {
|
92789
92656
|
case 'time':
|
92790
|
-
return
|
92657
|
+
return _this.renderTimePickerOverlay(name, rangeOverlayProps);
|
92791
92658
|
|
92792
92659
|
case 'months':
|
92793
|
-
return
|
92660
|
+
return _this.renderMonthPickerOverlay(name, rangeOverlayProps);
|
92794
92661
|
|
92795
92662
|
case 'years':
|
92796
|
-
return
|
92663
|
+
return _this.renderYearPickerOverlay(name, rangeOverlayProps);
|
92797
92664
|
|
92798
92665
|
case 'calendar':
|
92799
|
-
default:
|
92800
92666
|
return React__default.createElement(Overlay$1, rangeOverlayProps);
|
92801
92667
|
}
|
92802
|
-
}
|
92803
|
-
|
92804
|
-
|
92805
|
-
|
92806
|
-
|
92807
|
-
|
92808
|
-
|
92809
|
-
|
92810
|
-
|
92811
|
-
|
92812
|
-
|
92813
|
-
}, {
|
92814
|
-
key: "renderMonthPickerOverlay",
|
92815
|
-
value: function renderMonthPickerOverlay(name, propsOverlay) {
|
92668
|
+
};
|
92669
|
+
|
92670
|
+
_this.renderOverlayFrom = function (propsOverlay) {
|
92671
|
+
return _this.renderOverlay('from', propsOverlay, _this.props.staticPosition);
|
92672
|
+
};
|
92673
|
+
|
92674
|
+
_this.renderOverlayTo = function (propsOverlay) {
|
92675
|
+
return _this.renderOverlay('to', propsOverlay, _this.props.staticPosition);
|
92676
|
+
};
|
92677
|
+
|
92678
|
+
_this.renderMonthPickerOverlay = function (name, propsOverlay) {
|
92816
92679
|
var monthPickerProps = {
|
92817
|
-
value:
|
92818
|
-
onChange:
|
92680
|
+
value: _this.state['currentMonth'],
|
92681
|
+
onChange: _this.handleCurrentMonthChange
|
92819
92682
|
};
|
92820
92683
|
return React__default.createElement(MonthPickerOverlay, _extends_1({
|
92821
92684
|
key: "".concat(name, "-month-picker-overlay")
|
92822
92685
|
}, monthPickerProps, propsOverlay));
|
92823
|
-
}
|
92824
|
-
}, {
|
92825
|
-
key: "renderTimePickerOverlay",
|
92826
|
-
value: function renderTimePickerOverlay(name, propsOverlay) {
|
92827
|
-
var _this5 = this;
|
92686
|
+
};
|
92828
92687
|
|
92688
|
+
_this.renderTimePickerOverlay = function (name, propsOverlay) {
|
92829
92689
|
var timePickerProps = {
|
92830
|
-
value:
|
92690
|
+
value: _this.props[name],
|
92831
92691
|
onChange: function onChange(date, precision) {
|
92832
|
-
return
|
92692
|
+
return _this.handleTimeChange(name, date, precision);
|
92833
92693
|
},
|
92834
|
-
onCalendarClick:
|
92694
|
+
onCalendarClick: function onCalendarClick() {
|
92695
|
+
return _this.openPanel('calendar');
|
92696
|
+
}
|
92835
92697
|
};
|
92836
92698
|
return React__default.createElement(TimePickerOverlay$1, _extends_1({
|
92837
92699
|
key: "".concat(name, "-time-picker-overlay")
|
92838
92700
|
}, timePickerProps, propsOverlay));
|
92839
|
-
}
|
92840
|
-
|
92841
|
-
|
92842
|
-
value: function renderYearPickerOverlay(name, propsOverlay) {
|
92701
|
+
};
|
92702
|
+
|
92703
|
+
_this.renderYearPickerOverlay = function (name, propsOverlay) {
|
92843
92704
|
var yearPickerProps = {
|
92844
|
-
value:
|
92845
|
-
onChange:
|
92846
|
-
disabledFutureDays:
|
92847
|
-
disabledPastDays: this.props.disablePastDays
|
92705
|
+
value: _this.state['currentMonth'],
|
92706
|
+
onChange: _this.handleCurrentMonthChange,
|
92707
|
+
disabledFutureDays: _this.props.disableFutureDays
|
92848
92708
|
};
|
92849
92709
|
return React__default.createElement(YearPickerOverlay, _extends_1({
|
92850
92710
|
key: "".concat(name, "-year-picker-overlay")
|
92851
92711
|
}, yearPickerProps, propsOverlay));
|
92712
|
+
};
|
92713
|
+
|
92714
|
+
_this.state = {
|
92715
|
+
currentMonth: new Date(),
|
92716
|
+
focusedInput: '',
|
92717
|
+
openedPanel: 'calendar',
|
92718
|
+
keyFrom: 1,
|
92719
|
+
keyTo: 1
|
92720
|
+
};
|
92721
|
+
return _this;
|
92722
|
+
}
|
92723
|
+
|
92724
|
+
createClass(HiDateRangePicker, [{
|
92725
|
+
key: "componentWillUnmount",
|
92726
|
+
value: function componentWillUnmount() {
|
92727
|
+
clearTimeout(this.timeout);
|
92852
92728
|
}
|
92853
92729
|
}, {
|
92854
92730
|
key: "render",
|
92855
92731
|
value: function render() {
|
92856
|
-
var
|
92732
|
+
var _this2 = this,
|
92857
92733
|
_classNames;
|
92858
92734
|
|
92859
|
-
var _this$
|
92860
|
-
classes = _this$
|
92861
|
-
|
92862
|
-
|
92863
|
-
disableFutureDays = _this$
|
92864
|
-
enableTime = _this$
|
92865
|
-
labelFrom = _this$
|
92866
|
-
labelTo = _this$
|
92867
|
-
locale = _this$
|
92868
|
-
format = _this$
|
92869
|
-
from = _this$
|
92870
|
-
|
92871
|
-
|
92872
|
-
|
92873
|
-
|
92874
|
-
|
92875
|
-
|
92876
|
-
|
92735
|
+
var _this$props2 = this.props,
|
92736
|
+
classes = _this$props2.classes,
|
92737
|
+
disabled = _this$props2.disabled,
|
92738
|
+
disabledDays = _this$props2.disabledDays,
|
92739
|
+
disableFutureDays = _this$props2.disableFutureDays,
|
92740
|
+
enableTime = _this$props2.enableTime,
|
92741
|
+
labelFrom = _this$props2.labelFrom,
|
92742
|
+
labelTo = _this$props2.labelTo,
|
92743
|
+
locale = _this$props2.locale,
|
92744
|
+
format = _this$props2.format,
|
92745
|
+
from = _this$props2.from,
|
92746
|
+
fromError = _this$props2.fromError,
|
92747
|
+
minimumDate = _this$props2.minimumDate,
|
92748
|
+
onReset = _this$props2.onReset,
|
92749
|
+
to = _this$props2.to,
|
92750
|
+
toError = _this$props2.toError,
|
92751
|
+
translations = _this$props2.translations,
|
92752
|
+
id = _this$props2.id,
|
92753
|
+
staticPosition = _this$props2.staticPosition,
|
92754
|
+
errorText = _this$props2.errorText,
|
92755
|
+
hasSelector = _this$props2.hasSelector,
|
92756
|
+
helperIcon = _this$props2.helperIcon,
|
92757
|
+
helperText = _this$props2.helperText,
|
92758
|
+
props = objectWithoutProperties(_this$props2, ["classes", "disabled", "disabledDays", "disableFutureDays", "enableTime", "labelFrom", "labelTo", "locale", "format", "from", "fromError", "minimumDate", "onReset", "to", "toError", "translations", "id", "staticPosition", "errorText", "hasSelector", "helperIcon", "helperText"]);
|
92877
92759
|
|
92878
|
-
var _this$state = this.state,
|
92879
|
-
fromCurrentMonth = _this$state.fromCurrentMonth,
|
92880
|
-
toCurrentMonth = _this$state.toCurrentMonth;
|
92881
92760
|
var now = new Date();
|
92882
92761
|
var modifiers = {
|
92883
92762
|
start: from,
|
@@ -92922,99 +92801,81 @@
|
|
92922
92801
|
selectedDays: selectedDays,
|
92923
92802
|
todayButton: translations.today,
|
92924
92803
|
weekdayElement: Weekday$1
|
92925
|
-
}, props);
|
92926
|
-
// Disable days after 'to' date if define
|
92927
|
-
|
92928
|
-
|
92929
|
-
var after;
|
92930
|
-
|
92931
|
-
if (to instanceof Date && disableFutureDays) {
|
92932
|
-
after = to < now ? now : to;
|
92933
|
-
} else if (to instanceof Date) {
|
92934
|
-
after = to;
|
92935
|
-
} else if (disableFutureDays) {
|
92936
|
-
after = now;
|
92937
|
-
}
|
92938
|
-
|
92939
|
-
var disabledDaysFrom = _extends_1({}, disablePastDays && {
|
92940
|
-
before: now
|
92941
|
-
}, (to || disableFutureDays) && {
|
92942
|
-
after: after
|
92943
|
-
}, disabledDays);
|
92804
|
+
}, props);
|
92944
92805
|
|
92945
92806
|
var fromDayPickerProps = _extends_1({}, dayPickerProps, {
|
92946
|
-
onTodayButtonClick: this.
|
92947
|
-
|
92948
|
-
captionElement: this.
|
92949
|
-
disabledDays:
|
92950
|
-
|
92951
|
-
|
92952
|
-
|
92953
|
-
}
|
92954
|
-
|
92955
|
-
|
92956
|
-
|
92957
|
-
|
92958
|
-
|
92959
|
-
|
92960
|
-
if (from instanceof Date && disablePastDays) {
|
92961
|
-
before = from < now ? now : from;
|
92962
|
-
} else if (from instanceof Date) {
|
92963
|
-
before = from;
|
92964
|
-
} else if (disablePastDays) {
|
92965
|
-
before = now;
|
92966
|
-
}
|
92967
|
-
|
92968
|
-
var disabledDaysTo = _extends_1({}, (from || disablePastDays) && {
|
92969
|
-
before: before
|
92970
|
-
}, disableFutureDays && {
|
92971
|
-
after: now
|
92972
|
-
}, disabledDays);
|
92807
|
+
onTodayButtonClick: this.handleCurrentMonthChange,
|
92808
|
+
navbarElement: this.renderNavBar,
|
92809
|
+
captionElement: this.renderCaption,
|
92810
|
+
disabledDays: _extends_1({
|
92811
|
+
before: minimumDate
|
92812
|
+
}, disableFutureDays && {
|
92813
|
+
after: now
|
92814
|
+
}, to && {
|
92815
|
+
after: to
|
92816
|
+
}),
|
92817
|
+
month: this.state.currentMonth,
|
92818
|
+
modifiers: _extends_1({}, modifiers)
|
92819
|
+
});
|
92973
92820
|
|
92974
92821
|
var toDayPickerProps = _extends_1({}, dayPickerProps, {
|
92975
|
-
onTodayButtonClick: this.
|
92976
|
-
|
92977
|
-
|
92978
|
-
|
92979
|
-
|
92980
|
-
|
92981
|
-
|
92982
|
-
|
92822
|
+
onTodayButtonClick: this.handleCurrentMonthChange,
|
92823
|
+
navbarElement: this.renderNavBar,
|
92824
|
+
onDayClick: this.onDayToClick,
|
92825
|
+
captionElement: this.renderCaption,
|
92826
|
+
disabledDays: _extends_1({
|
92827
|
+
before: minimumDate
|
92828
|
+
}, disableFutureDays && {
|
92829
|
+
after: now
|
92830
|
+
}, from && {
|
92831
|
+
before: from
|
92832
|
+
}),
|
92833
|
+
month: this.state.currentMonth,
|
92834
|
+
modifiers: _extends_1({}, modifiers)
|
92983
92835
|
}); // From & To InputProps
|
92984
92836
|
|
92985
92837
|
|
92986
92838
|
var fromInputProps = _extends_1({}, onReset && {
|
92987
92839
|
onReset: function onReset() {
|
92988
|
-
return
|
92840
|
+
return _this2.handleReset('from');
|
92989
92841
|
}
|
92990
|
-
}, props,
|
92842
|
+
}, props, fromError && {
|
92843
|
+
error: true
|
92844
|
+
}, labelFrom && {
|
92991
92845
|
label: labelFrom
|
92992
92846
|
}, {
|
92993
92847
|
id: "".concat(id, "-from"),
|
92994
|
-
onChange: this.handleInputChange('from')
|
92848
|
+
onChange: this.handleInputChange('from'),
|
92849
|
+
disabled: disabled
|
92995
92850
|
});
|
92996
92851
|
|
92997
92852
|
var toInputProps = _extends_1({}, onReset && {
|
92998
92853
|
onReset: function onReset() {
|
92999
|
-
return
|
92854
|
+
return _this2.handleReset('to');
|
93000
92855
|
}
|
93001
|
-
}, props,
|
92856
|
+
}, props, toError && {
|
92857
|
+
error: true
|
92858
|
+
}, labelTo && {
|
93002
92859
|
label: labelTo
|
93003
92860
|
}, {
|
93004
92861
|
id: "".concat(id, "-to"),
|
93005
|
-
onChange: this.handleInputChange('to')
|
92862
|
+
onChange: this.handleInputChange('to'),
|
92863
|
+
disabled: disabled
|
93006
92864
|
});
|
93007
92865
|
|
93008
92866
|
var toClass = classnames(classes.toInput, (_classNames = {}, defineProperty(_classNames, classes.absolute, staticPosition === true && this.state.focusedInput === 'from'), defineProperty(_classNames, classes.right4, staticPosition === true && this.state.focusedInput === 'from'), _classNames));
|
93009
|
-
|
92867
|
+
var content = React__default.createElement("div", {
|
93010
92868
|
className: classnames(classes.root, classes.rangePickerContainer)
|
93011
92869
|
}, React__default.createElement("div", {
|
93012
92870
|
className: classes.fromInput,
|
93013
|
-
onFocus:
|
93014
|
-
|
92871
|
+
onFocus: function onFocus() {
|
92872
|
+
return _this2.handleDayPickerFocus('from');
|
92873
|
+
} // onBlur={() => this.handleDayPickerBlur('from')}
|
92874
|
+
|
93015
92875
|
}, React__default.createElement("div", null, React__default.createElement(DayPickerInput_1$1, {
|
92876
|
+
key: this.state.keyFrom,
|
93016
92877
|
ref: function ref(el) {
|
93017
|
-
|
92878
|
+
_this2.fromInput = el;
|
93018
92879
|
},
|
93019
92880
|
value: from,
|
93020
92881
|
hideOnDayClick: false,
|
@@ -93025,15 +92886,22 @@
|
|
93025
92886
|
format: enableTime ? "".concat(format, " HH:mm") : format,
|
93026
92887
|
formatDate: moment$1.formatDate,
|
93027
92888
|
parseDate: moment$1.parseDate,
|
93028
|
-
onDayChange:
|
92889
|
+
onDayChange: function onDayChange(day) {
|
92890
|
+
return _this2.handleDayChange('from', day);
|
92891
|
+
},
|
93029
92892
|
placeholder: ''
|
93030
92893
|
}))), React__default.createElement("div", {
|
93031
92894
|
className: toClass,
|
93032
|
-
onFocus:
|
93033
|
-
|
92895
|
+
onFocus: function onFocus() {
|
92896
|
+
return _this2.handleDayPickerFocus('to');
|
92897
|
+
},
|
92898
|
+
onBlur: function onBlur() {
|
92899
|
+
return _this2.handleDayPickerBlur('to');
|
92900
|
+
}
|
93034
92901
|
}, React__default.createElement(DayPickerInput_1$1, {
|
92902
|
+
key: this.state.keyTo,
|
93035
92903
|
ref: function ref(el) {
|
93036
|
-
|
92904
|
+
_this2.toInput = el;
|
93037
92905
|
},
|
93038
92906
|
value: to,
|
93039
92907
|
hideOnDayClick: false,
|
@@ -93043,10 +92911,23 @@
|
|
93043
92911
|
inputProps: toInputProps,
|
93044
92912
|
format: enableTime ? "".concat(format, " HH:mm") : format,
|
93045
92913
|
formatDate: moment$1.formatDate,
|
93046
|
-
parseDate: moment$1.parseDate,
|
93047
|
-
|
92914
|
+
parseDate: moment$1.parseDate //onDayChange={(day) => this.handleDayChange('to', day)}
|
92915
|
+
,
|
93048
92916
|
placeholder: ''
|
93049
92917
|
})));
|
92918
|
+
|
92919
|
+
if (!hasSelector) {
|
92920
|
+
content = React__default.createElement(HiFormControl$1, {
|
92921
|
+
disabled: disabled,
|
92922
|
+
helperIcon: helperIcon,
|
92923
|
+
helperText: helperText,
|
92924
|
+
errorText: errorText,
|
92925
|
+
error: fromError || toError,
|
92926
|
+
label: ' '
|
92927
|
+
}, content);
|
92928
|
+
}
|
92929
|
+
|
92930
|
+
return content;
|
93050
92931
|
}
|
93051
92932
|
}]);
|
93052
92933
|
|
@@ -93055,22 +92936,26 @@
|
|
93055
92936
|
|
93056
92937
|
HiDateRangePicker.defaultProps = {
|
93057
92938
|
disabledDays: [],
|
93058
|
-
|
93059
|
-
disableFutureDays: false,
|
92939
|
+
disableFutureDays: true,
|
93060
92940
|
staticPosition: false,
|
93061
92941
|
enableTime: false,
|
93062
|
-
|
92942
|
+
hasSelector: false,
|
92943
|
+
format: 'YYYY-MM-DD',
|
93063
92944
|
labelFrom: 'Start',
|
93064
92945
|
labelTo: 'End',
|
93065
92946
|
locale: 'fr-FR',
|
93066
|
-
minimumDate: new Date(2013, 4, 1),
|
93067
|
-
// by default 1 May 2013
|
93068
92947
|
translations: {
|
93069
92948
|
today: 'today',
|
93070
92949
|
hour: 'Hour',
|
93071
92950
|
minute: 'Minute',
|
93072
92951
|
month: 'Month',
|
93073
|
-
year: 'Year'
|
92952
|
+
year: 'Year',
|
92953
|
+
invalid_format: 'The date format is not valid',
|
92954
|
+
to_superior_from: 'Date from cannot be greater than date to',
|
92955
|
+
missing_date_from: 'Missing date from',
|
92956
|
+
missing_date_to: 'Missing date to',
|
92957
|
+
date_superior_max_date: 'Date from cannot be greater than %s',
|
92958
|
+
date_inferior_min_date: 'Date from cannot be before than %s'
|
93074
92959
|
}
|
93075
92960
|
};
|
93076
92961
|
HiDateRangePicker.propTypes = {
|
@@ -93084,25 +92969,20 @@
|
|
93084
92969
|
*/
|
93085
92970
|
disabled: propTypes.bool,
|
93086
92971
|
|
93087
|
-
/**
|
93088
|
-
* Définie les jours non sélectionnables
|
93089
|
-
*/
|
93090
|
-
disabledDays: propTypes.oneOfType([propTypes.array, propTypes.object, propTypes.instanceOf(Date)]),
|
93091
|
-
|
93092
92972
|
/**
|
93093
92973
|
* Uniquement la sélection de date antérieures à aujourd'hui (inclu)
|
93094
92974
|
*/
|
93095
92975
|
disableFutureDays: propTypes.bool,
|
93096
92976
|
|
93097
92977
|
/**
|
93098
|
-
*
|
92978
|
+
* Ajoute la gestion de l'heure
|
93099
92979
|
*/
|
93100
|
-
|
92980
|
+
enableTime: propTypes.bool,
|
93101
92981
|
|
93102
92982
|
/**
|
93103
|
-
*
|
92983
|
+
* Texte de l'erreur
|
93104
92984
|
*/
|
93105
|
-
|
92985
|
+
errorText: propTypes.string,
|
93106
92986
|
|
93107
92987
|
/**
|
93108
92988
|
* Format des dates affichées
|
@@ -93112,7 +92992,29 @@
|
|
93112
92992
|
/**
|
93113
92993
|
* Date de début sélectionnée
|
93114
92994
|
*/
|
93115
|
-
from: propTypes.
|
92995
|
+
from: propTypes.instanceOf(Date),
|
92996
|
+
//from: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
92997
|
+
|
92998
|
+
/**
|
92999
|
+
* Erreur sur date from
|
93000
|
+
*/
|
93001
|
+
fromError: propTypes.bool,
|
93002
|
+
|
93003
|
+
/**
|
93004
|
+
* @ignore
|
93005
|
+
* Si true, on n'enveloppe pas le composant avec un HiFormControl
|
93006
|
+
*/
|
93007
|
+
hasSelector: propTypes.bool,
|
93008
|
+
|
93009
|
+
/**
|
93010
|
+
* Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
|
93011
|
+
*/
|
93012
|
+
helperIcon: propTypes.bool,
|
93013
|
+
|
93014
|
+
/**
|
93015
|
+
* Texte de l'aide
|
93016
|
+
*/
|
93017
|
+
helperText: propTypes.string,
|
93116
93018
|
|
93117
93019
|
/**
|
93118
93020
|
* Utilisé pour construire les ids des champs from et to en les suffixant "-from" et "-to"
|
@@ -93137,7 +93039,7 @@
|
|
93137
93039
|
/**
|
93138
93040
|
* Date minimale sélectionnable
|
93139
93041
|
*/
|
93140
|
-
minimumDate: propTypes.instanceOf(Date),
|
93042
|
+
minimumDate: propTypes.instanceOf(Date).isRequired,
|
93141
93043
|
|
93142
93044
|
/**
|
93143
93045
|
* Callback à la sélection d'une date
|
@@ -93150,7 +93052,7 @@
|
|
93150
93052
|
* @param {string} nom du champs
|
93151
93053
|
* @param {string} nouvelle valeur du champs
|
93152
93054
|
*/
|
93153
|
-
onChange: propTypes.func,
|
93055
|
+
onChange: propTypes.func.isRequired,
|
93154
93056
|
|
93155
93057
|
/**
|
93156
93058
|
* Callback au reset de l'input
|
@@ -93166,7 +93068,12 @@
|
|
93166
93068
|
/**
|
93167
93069
|
* Date de fin sélectionnée
|
93168
93070
|
*/
|
93169
|
-
to: propTypes.
|
93071
|
+
to: propTypes.instanceOf(Date),
|
93072
|
+
|
93073
|
+
/**
|
93074
|
+
* Erreur sur date to
|
93075
|
+
*/
|
93076
|
+
toError: propTypes.bool,
|
93170
93077
|
|
93171
93078
|
/**
|
93172
93079
|
* Traductions
|
@@ -94067,6 +93974,9 @@
|
|
94067
93974
|
activeColorNeutral: {
|
94068
93975
|
color: theme.palette.neutral.contrastText,
|
94069
93976
|
backgroundColor: theme.palette.neutral.main
|
93977
|
+
},
|
93978
|
+
outlined: {
|
93979
|
+
border: '1px solid'
|
94070
93980
|
}
|
94071
93981
|
};
|
94072
93982
|
};
|
@@ -94084,15 +93994,16 @@
|
|
94084
93994
|
label = props.label,
|
94085
93995
|
color = props.color,
|
94086
93996
|
active = props.active,
|
93997
|
+
outlined = props.outlined,
|
94087
93998
|
fontWeight = props.fontWeight,
|
94088
93999
|
style = props.style,
|
94089
94000
|
theme = props.theme,
|
94090
|
-
other = objectWithoutProperties(props, ["classes", "className", "label", "color", "active", "fontWeight", "style", "theme"]);
|
94001
|
+
other = objectWithoutProperties(props, ["classes", "className", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
94091
94002
|
|
94092
94003
|
var isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
94093
94004
|
var isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
94094
94005
|
return React__default.createElement("div", _extends_1({
|
94095
|
-
className: classnames(classes.root, (_classNames = {}, defineProperty(_classNames, classes.color, !active), defineProperty(_classNames, classes.activeColor, active), defineProperty(_classNames, classes["activeColor".concat(capitalize(color))], active && isHiColor), defineProperty(_classNames, classes["color".concat(capitalize(color))], !active && isHiColor), _classNames), className),
|
94006
|
+
className: classnames(classes.root, (_classNames = {}, defineProperty(_classNames, classes.color, !active), defineProperty(_classNames, classes.activeColor, active), defineProperty(_classNames, classes.outlined, outlined), defineProperty(_classNames, classes["activeColor".concat(capitalize(color))], active && isHiColor), defineProperty(_classNames, classes["color".concat(capitalize(color))], !active && isHiColor), _classNames), className),
|
94096
94007
|
style: _extends_1({}, style, isHexColor && {
|
94097
94008
|
backgroundColor: active ? color : fade(color, 0.08),
|
94098
94009
|
color: active ? theme.palette.getContrastText(color) : color
|
@@ -94132,11 +94043,17 @@
|
|
94132
94043
|
/**
|
94133
94044
|
* Label à afficher
|
94134
94045
|
*/
|
94135
|
-
label: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.node]).isRequired
|
94046
|
+
label: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.node]).isRequired,
|
94047
|
+
|
94048
|
+
/**
|
94049
|
+
* Ajoute une bordure
|
94050
|
+
*/
|
94051
|
+
outlined: propTypes.bool
|
94136
94052
|
};
|
94137
94053
|
HiColoredLabel.defaultProps = {
|
94138
94054
|
active: false,
|
94139
|
-
color: 'primary'
|
94055
|
+
color: 'primary',
|
94056
|
+
outlined: false
|
94140
94057
|
};
|
94141
94058
|
var HiColoredLabel$1 = withStyles(styles$o, {
|
94142
94059
|
hiComponent: true,
|
@@ -98845,6 +98762,31 @@
|
|
98845
98762
|
name: 'HmuiHiSelectableListHierarchic'
|
98846
98763
|
})(HiSelectableListHierarchic);
|
98847
98764
|
|
98765
|
+
var ArrowDropDown = createCommonjsModule(function (module, exports) {
|
98766
|
+
|
98767
|
+
|
98768
|
+
|
98769
|
+
Object.defineProperty(exports, "__esModule", {
|
98770
|
+
value: true
|
98771
|
+
});
|
98772
|
+
exports.default = void 0;
|
98773
|
+
|
98774
|
+
var _react = interopRequireDefault(React__default);
|
98775
|
+
|
98776
|
+
var _createSvgIcon = interopRequireDefault(createSvgIcon_1);
|
98777
|
+
|
98778
|
+
var _default = (0, _createSvgIcon.default)(_react.default.createElement(_react.default.Fragment, null, _react.default.createElement("path", {
|
98779
|
+
d: "M7 10l5 5 5-5z"
|
98780
|
+
}), _react.default.createElement("path", {
|
98781
|
+
fill: "none",
|
98782
|
+
d: "M0 0h24v24H0z"
|
98783
|
+
})), 'ArrowDropDown');
|
98784
|
+
|
98785
|
+
exports.default = _default;
|
98786
|
+
});
|
98787
|
+
|
98788
|
+
var ArrowDropDownIcon = unwrapExports(ArrowDropDown);
|
98789
|
+
|
98848
98790
|
var styles$s = function styles(theme) {
|
98849
98791
|
return {
|
98850
98792
|
root: {
|
@@ -98911,13 +98853,13 @@
|
|
98911
98853
|
transform: 'scaleX(1)'
|
98912
98854
|
},
|
98913
98855
|
'&$error': {
|
98914
|
-
border: "1px solid ".concat(theme.palette.negative.
|
98856
|
+
border: "1px solid ".concat(theme.palette.negative.main),
|
98915
98857
|
borderRadius: 2
|
98916
98858
|
}
|
98917
98859
|
}
|
98918
98860
|
},
|
98919
98861
|
disabled: {
|
98920
|
-
color:
|
98862
|
+
color: theme.palette.text.disabled,
|
98921
98863
|
'&:before': {
|
98922
98864
|
display: 'none'
|
98923
98865
|
}
|
@@ -98934,13 +98876,17 @@
|
|
98934
98876
|
display: 'inline-flex',
|
98935
98877
|
width: '100%'
|
98936
98878
|
}),
|
98879
|
+
placeholder: {
|
98880
|
+
color: theme.palette.grey[400]
|
98881
|
+
},
|
98937
98882
|
icon: {
|
98938
98883
|
transition: theme.transitions.create(['opacity', 'transform'], {
|
98939
98884
|
duration: theme.transitions.duration.shorter
|
98940
98885
|
})
|
98941
98886
|
},
|
98942
98887
|
iconOpen: {
|
98943
|
-
transform: 'rotate(90deg)'
|
98888
|
+
transform: 'rotate(90deg)',
|
98889
|
+
color: theme.palette.primary.main
|
98944
98890
|
},
|
98945
98891
|
iconClose: {
|
98946
98892
|
transform: 'rotate(0deg)'
|
@@ -98951,24 +98897,26 @@
|
|
98951
98897
|
* @ignore - internal component.
|
98952
98898
|
*/
|
98953
98899
|
|
98954
|
-
var
|
98900
|
+
var _ref$5 = React__default.createElement(ArrowDropDownIcon, null);
|
98901
|
+
|
98902
|
+
var HiSelectInput =
|
98955
98903
|
/*#__PURE__*/
|
98956
98904
|
function (_React$PureComponent) {
|
98957
|
-
inherits(
|
98905
|
+
inherits(HiSelectInput, _React$PureComponent);
|
98958
98906
|
|
98959
|
-
function
|
98907
|
+
function HiSelectInput(props) {
|
98960
98908
|
var _this;
|
98961
98909
|
|
98962
|
-
classCallCheck(this,
|
98910
|
+
classCallCheck(this, HiSelectInput);
|
98963
98911
|
|
98964
|
-
_this = possibleConstructorReturn(this, getPrototypeOf(
|
98912
|
+
_this = possibleConstructorReturn(this, getPrototypeOf(HiSelectInput).call(this, props));
|
98965
98913
|
|
98966
98914
|
_this.handleKeyDown = function (event) {
|
98967
98915
|
var key = keycode(event);
|
98968
98916
|
|
98969
|
-
if (
|
98970
|
-
|
98971
|
-
|
98917
|
+
if (_this.props.onKeyDown) {
|
98918
|
+
_this.props.onKeyDown(event);
|
98919
|
+
} else if (key === 'down' || key === 'up') {
|
98972
98920
|
_this.props.onClick();
|
98973
98921
|
} else if (key === 'enter' && _this.props.onSubmit) {
|
98974
98922
|
event.preventDefault();
|
@@ -98977,18 +98925,58 @@
|
|
98977
98925
|
}
|
98978
98926
|
};
|
98979
98927
|
|
98928
|
+
_this.handleKeyDownReset = function (event) {
|
98929
|
+
var key = keycode(event);
|
98930
|
+
|
98931
|
+
if (key === 'enter' || key === 'space') {
|
98932
|
+
_this.handleReset(event);
|
98933
|
+
|
98934
|
+
event.stopPropagation();
|
98935
|
+
event.preventDefault();
|
98936
|
+
}
|
98937
|
+
};
|
98938
|
+
|
98980
98939
|
_this.handleClick = function (event) {
|
98981
98940
|
if ((!_this.resetIcon || !_this.resetIcon.contains(event.target)) && _this.props.onClick) {
|
98982
98941
|
_this.props.onClick(event);
|
98983
98942
|
}
|
98984
98943
|
};
|
98985
98944
|
|
98945
|
+
_this.handleReset = function (event) {
|
98946
|
+
_this.props.onReset(event);
|
98947
|
+
|
98948
|
+
if (_this.input) {
|
98949
|
+
_this.input.focus();
|
98950
|
+
}
|
98951
|
+
};
|
98952
|
+
|
98953
|
+
_this.handleBlur = function (event) {
|
98954
|
+
if ((!_this.input || !_this.input.contains(event.relatedTarget)) && _this.props.onBlur) {
|
98955
|
+
_this.props.onBlur(event);
|
98956
|
+
} else {
|
98957
|
+
if (_this.input && (!_this.resetIcon || !_this.resetIcon.contains(event.relatedTarget))) {
|
98958
|
+
_this.input.focus();
|
98959
|
+
}
|
98960
|
+
}
|
98961
|
+
};
|
98962
|
+
|
98963
|
+
_this.handleRef = function (el) {
|
98964
|
+
_this.input = el;
|
98965
|
+
|
98966
|
+
if (_this.props.refElement) {
|
98967
|
+
_this.props.refElement(el);
|
98968
|
+
}
|
98969
|
+
};
|
98970
|
+
|
98986
98971
|
_this.handleKeyDown = _this.handleKeyDown.bind(assertThisInitialized(assertThisInitialized(_this)));
|
98987
98972
|
_this.handleClick = _this.handleClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
98973
|
+
_this.handleBlur = _this.handleBlur.bind(assertThisInitialized(assertThisInitialized(_this)));
|
98974
|
+
_this.handleRef = _this.handleRef.bind(assertThisInitialized(assertThisInitialized(_this)));
|
98975
|
+
_this.handleReset = _this.handleReset.bind(assertThisInitialized(assertThisInitialized(_this)));
|
98988
98976
|
return _this;
|
98989
98977
|
}
|
98990
98978
|
|
98991
|
-
createClass(
|
98979
|
+
createClass(HiSelectInput, [{
|
98992
98980
|
key: "render",
|
98993
98981
|
value: function render() {
|
98994
98982
|
var _classNames,
|
@@ -99006,16 +98994,14 @@
|
|
99006
98994
|
focused = _this$props.focused,
|
99007
98995
|
error = _this$props.error,
|
99008
98996
|
id = _this$props.id,
|
99009
|
-
|
99010
|
-
theme = _this$props.theme; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
|
98997
|
+
placeholder = _this$props.placeholder; // On utilise classNames pour variabiliser les styles et merge les classes appliquées
|
99011
98998
|
|
99012
98999
|
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));
|
99013
99000
|
var iconClass = classnames(classes.icon, (_classNames2 = {}, defineProperty(_classNames2, classes.iconOpen, open), defineProperty(_classNames2, classes.iconClose, !open), _classNames2));
|
99014
|
-
|
99001
|
+
return noButton ? React__default.createElement("div", {
|
99015
99002
|
id: id,
|
99016
99003
|
className: rootClass,
|
99017
99004
|
onClick: onClick,
|
99018
|
-
disabled: disabled,
|
99019
99005
|
onMouseEnter: this.props.onMouseEnter,
|
99020
99006
|
onMouseLeave: this.props.onMouseLeave,
|
99021
99007
|
onKeyDown: this.handleKeyDown,
|
@@ -99023,59 +99009,54 @@
|
|
99023
99009
|
onBlur: this.props.onBlur,
|
99024
99010
|
role: "button",
|
99025
99011
|
tabIndex: "0",
|
99026
|
-
ref:
|
99027
|
-
if (refElement) refElement(el);
|
99028
|
-
}
|
99012
|
+
ref: this.handleRef
|
99029
99013
|
}, React__default.createElement("span", {
|
99030
|
-
className: classes.label
|
99031
|
-
}, value), React__default.createElement(
|
99032
|
-
className: iconClass
|
99033
|
-
icon: "arrow_drop_down"
|
99014
|
+
className: classnames(classes.label, defineProperty({}, classes.placeholder, value === undefined))
|
99015
|
+
}, value || placeholder), React__default.createElement(ArrowDropDownIcon, {
|
99016
|
+
className: iconClass
|
99034
99017
|
})) : React__default.createElement(ButtonBase$2, {
|
99035
99018
|
id: id,
|
99036
|
-
|
99037
|
-
root: rootClass
|
99038
|
-
},
|
99019
|
+
className: rootClass,
|
99039
99020
|
onClick: this.handleClick,
|
99040
99021
|
disabled: disabled,
|
99041
99022
|
onMouseEnter: this.props.onMouseEnter,
|
99042
99023
|
onMouseLeave: this.props.onMouseLeave,
|
99043
99024
|
onKeyDown: this.handleKeyDown,
|
99044
99025
|
onFocus: this.props.onFocus,
|
99045
|
-
onBlur: this.
|
99046
|
-
buttonRef:
|
99047
|
-
if (refElement) refElement(el);
|
99048
|
-
}
|
99026
|
+
onBlur: this.handleBlur,
|
99027
|
+
buttonRef: this.handleRef
|
99049
99028
|
}, React__default.createElement("span", {
|
99050
|
-
className: classes.label
|
99051
|
-
}, value), onReset && focused && React__default.createElement("div", {
|
99029
|
+
className: classnames(classes.label, defineProperty({}, classes.placeholder, value === undefined))
|
99030
|
+
}, value || placeholder), onReset && focused && React__default.createElement("div", {
|
99052
99031
|
ref: function ref(el) {
|
99053
99032
|
_this2.resetIcon = el;
|
99054
99033
|
}
|
99055
99034
|
}, React__default.createElement(HiIcon$1, {
|
99056
99035
|
icon: "close",
|
99057
|
-
size:
|
99058
|
-
color:
|
99059
|
-
onClick:
|
99060
|
-
|
99061
|
-
|
99062
|
-
|
99063
|
-
|
99064
|
-
|
99036
|
+
size: 20,
|
99037
|
+
color: "neutral",
|
99038
|
+
onClick: this.handleReset,
|
99039
|
+
onKeyDown: this.handleKeyDownReset,
|
99040
|
+
tabIndex: 0
|
99041
|
+
})), React__default.createElement(Icon$2, {
|
99042
|
+
classes: {
|
99043
|
+
root: iconClass
|
99044
|
+
}
|
99045
|
+
}, _ref$5));
|
99065
99046
|
}
|
99066
99047
|
}]);
|
99067
99048
|
|
99068
|
-
return
|
99049
|
+
return HiSelectInput;
|
99069
99050
|
}(React__default.PureComponent);
|
99070
99051
|
|
99071
|
-
|
99052
|
+
HiSelectInput.defaultProps = {
|
99072
99053
|
disabled: false,
|
99073
99054
|
open: false,
|
99074
99055
|
focused: false,
|
99075
99056
|
noButton: false,
|
99076
99057
|
error: false
|
99077
99058
|
};
|
99078
|
-
|
99059
|
+
HiSelectInput.propTypes = {
|
99079
99060
|
/**
|
99080
99061
|
* Useful to extend the style applied to components.
|
99081
99062
|
*/
|
@@ -99123,12 +99104,17 @@
|
|
99123
99104
|
onFocus: propTypes.func,
|
99124
99105
|
|
99125
99106
|
/**
|
99126
|
-
* Fonction de callback
|
99107
|
+
* Fonction de callback à la pression de touche
|
99108
|
+
*/
|
99109
|
+
onKeyDown: propTypes.func,
|
99110
|
+
|
99111
|
+
/**
|
99112
|
+
* Fonction de callback au survol de l'input
|
99127
99113
|
*/
|
99128
99114
|
onMouseEnter: propTypes.func,
|
99129
99115
|
|
99130
99116
|
/**
|
99131
|
-
* Fonction de callback
|
99117
|
+
* Fonction de callback à la sortie du survol de l'input
|
99132
99118
|
*/
|
99133
99119
|
onMouseLeave: propTypes.func,
|
99134
99120
|
|
@@ -99147,6 +99133,11 @@
|
|
99147
99133
|
*/
|
99148
99134
|
open: propTypes.bool,
|
99149
99135
|
|
99136
|
+
/**
|
99137
|
+
* Placeholder
|
99138
|
+
*/
|
99139
|
+
placeholder: propTypes.string,
|
99140
|
+
|
99150
99141
|
/**
|
99151
99142
|
* Use that property to pass a ref callback to the native component.
|
99152
99143
|
*/
|
@@ -99157,11 +99148,10 @@
|
|
99157
99148
|
*/
|
99158
99149
|
value: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.node])
|
99159
99150
|
};
|
99160
|
-
var
|
99151
|
+
var HiSelectInput$1 = withStyles(styles$s, {
|
99161
99152
|
hiComponent: true,
|
99162
|
-
name: '
|
99163
|
-
|
99164
|
-
})(SelectInput);
|
99153
|
+
name: 'HmuiHiSelectInput'
|
99154
|
+
})(HiSelectInput);
|
99165
99155
|
|
99166
99156
|
var styles$t = function styles(theme) {
|
99167
99157
|
return {
|
@@ -99177,14 +99167,24 @@
|
|
99177
99167
|
popperWidth: {
|
99178
99168
|
width: '100% !important'
|
99179
99169
|
},
|
99170
|
+
popperRightAlign: {
|
99171
|
+
right: 0,
|
99172
|
+
left: 'unset!important'
|
99173
|
+
},
|
99180
99174
|
paper: {
|
99181
99175
|
borderRadius: '0px 2px',
|
99182
|
-
maxHeight:
|
99176
|
+
maxHeight: 480,
|
99183
99177
|
transition: 'none !important'
|
99184
99178
|
},
|
99185
99179
|
labelIcon: {
|
99186
99180
|
marginRight: 10
|
99187
99181
|
},
|
99182
|
+
labelImg: {
|
99183
|
+
height: 18,
|
99184
|
+
width: 'auto',
|
99185
|
+
margin: '0 4px',
|
99186
|
+
verticalAlign: 'middle'
|
99187
|
+
},
|
99188
99188
|
selectIconLabel: _extends_1({
|
99189
99189
|
whiteSpace: 'nowrap',
|
99190
99190
|
overflow: 'hidden',
|
@@ -99193,6 +99193,15 @@
|
|
99193
99193
|
}, theme.typography.b1, {
|
99194
99194
|
display: 'inline-flex',
|
99195
99195
|
width: '100%'
|
99196
|
+
}),
|
99197
|
+
selectImgLabel: _extends_1({
|
99198
|
+
whiteSpace: 'nowrap',
|
99199
|
+
overflow: 'hidden',
|
99200
|
+
textOverflow: 'ellipsis',
|
99201
|
+
paddingRight: 16
|
99202
|
+
}, theme.typography.b1, {
|
99203
|
+
display: 'inline-flex',
|
99204
|
+
width: '100%'
|
99196
99205
|
})
|
99197
99206
|
};
|
99198
99207
|
};
|
@@ -99206,9 +99215,8 @@
|
|
99206
99215
|
* - prise en compte du type des éléments (text, image, icon, ...)
|
99207
99216
|
*
|
99208
99217
|
* Ce composant réuni les sous-composants
|
99209
|
-
* -
|
99210
|
-
* - HiSearchField : intègre une barre de recherche dans le Popper,
|
99211
|
-
* il filtre la liste des suggestions
|
99218
|
+
* - HiSelectInput : affiche l'élément dans le formulaire
|
99219
|
+
* - HiSearchField : intègre une barre de recherche dans le Popper, il filtre la liste des suggestions
|
99212
99220
|
* - HiSelectableList : affiche la liste des suggestions selon le type des éléments
|
99213
99221
|
*/
|
99214
99222
|
|
@@ -99217,12 +99225,12 @@
|
|
99217
99225
|
function (_React$PureComponent) {
|
99218
99226
|
inherits(HiSelect, _React$PureComponent);
|
99219
99227
|
|
99220
|
-
function HiSelect(
|
99228
|
+
function HiSelect(props) {
|
99221
99229
|
var _this;
|
99222
99230
|
|
99223
99231
|
classCallCheck(this, HiSelect);
|
99224
99232
|
|
99225
|
-
_this = possibleConstructorReturn(this, getPrototypeOf(HiSelect).call(this,
|
99233
|
+
_this = possibleConstructorReturn(this, getPrototypeOf(HiSelect).call(this, props));
|
99226
99234
|
|
99227
99235
|
_this.handleClick = function () {
|
99228
99236
|
if (_this.state.open) {
|
@@ -99232,101 +99240,51 @@
|
|
99232
99240
|
open: true
|
99233
99241
|
});
|
99234
99242
|
|
99235
|
-
|
99236
|
-
|
99237
|
-
_this.handleSuggestions(options);
|
99238
|
-
|
99239
|
-
if (_this.props.onClick) {
|
99240
|
-
_this.props.onClick();
|
99241
|
-
} // Gestion du focus
|
99243
|
+
_this.handleSuggestions(_this.props.options);
|
99242
99244
|
|
99245
|
+
if (_this.props.onClick) _this.props.onClick(); // Gestion du focus
|
99243
99246
|
|
99244
99247
|
if (!_this.props.searchable) {
|
99245
|
-
// sinon focus sur le
|
99246
|
-
_this.
|
99248
|
+
// sinon focus sur le premier élément de la liste
|
99249
|
+
_this.focusOnFirstItem();
|
99247
99250
|
}
|
99248
99251
|
}
|
99249
99252
|
};
|
99250
99253
|
|
99251
|
-
_this.
|
99252
|
-
// Construct two associative arrays
|
99253
|
-
// hierarchy[parentId] => children
|
99254
|
-
// hierarchySelected[parentId] => selected children
|
99255
|
-
var hierarchy = {};
|
99256
|
-
var hierarchySelected = {};
|
99257
|
-
var value = props.value || [];
|
99258
|
-
if (!Array.isArray(value)) value = [props.value];
|
99259
|
-
props.options.forEach(function (option) {
|
99260
|
-
if (option.hasChildren === true && !hierarchy.hasOwnProperty(option.id)) {
|
99261
|
-
hierarchy[option.id] = [];
|
99262
|
-
hierarchySelected[option.id] = [];
|
99263
|
-
} else if (option.hasOwnProperty('parentId')) {
|
99264
|
-
hierarchy[option.parentId].push(option.id);
|
99265
|
-
|
99266
|
-
if (value.includes(option.id)) {
|
99267
|
-
hierarchySelected[option.parentId].push(option.id);
|
99268
|
-
}
|
99269
|
-
}
|
99270
|
-
});
|
99271
|
-
return {
|
99272
|
-
hierarchy: hierarchy,
|
99273
|
-
hierarchySelected: hierarchySelected
|
99274
|
-
};
|
99275
|
-
};
|
99276
|
-
|
99277
|
-
_this.focusOnSelectedItem = function () {
|
99278
|
-
// On récupère la div parent "overlay"
|
99254
|
+
_this.focusOnFirstItem = function () {
|
99279
99255
|
var overlay = require$$11.findDOMNode(_this.overlay);
|
99280
|
-
var multiple = _this.props.multiple;
|
99281
|
-
var value = _this.props.value;
|
99282
|
-
var selectedIdList = Array.isArray(value) ? value : [value];
|
99283
99256
|
setTimeout(function () {
|
99284
|
-
var
|
99285
|
-
|
99286
|
-
if (selectedIdList.length > 0) {
|
99287
|
-
var itemSelected = overlay.querySelector("[data-id=\"".concat(selectedIdList[selectedIdList.length - 1], "\"]"));
|
99288
|
-
|
99289
|
-
if (itemSelected && itemSelected.parentElement.tagName === 'LI') {
|
99290
|
-
itemSelected.parentElement.focus();
|
99291
|
-
focused = true;
|
99292
|
-
}
|
99293
|
-
} // Si pas d'item selectionné, ou pas visible (en cas de recherche), focus sur le premier
|
99294
|
-
|
99295
|
-
|
99296
|
-
if (selectedIdList.length === 0 || !focused) {
|
99297
|
-
// On recupère tous les items
|
99298
|
-
var items = overlay.getElementsByTagName('li');
|
99299
|
-
var itemToFocus = items[0]; // Si select multiple, et qu'au moins un selectionné, focus sur le 2e item
|
99300
|
-
|
99301
|
-
if (multiple && selectedIdList.length > 0) {
|
99302
|
-
itemToFocus = items[1];
|
99303
|
-
}
|
99304
|
-
|
99305
|
-
if (itemToFocus) {
|
99306
|
-
itemToFocus.focus();
|
99307
|
-
}
|
99308
|
-
}
|
99257
|
+
var item = overlay.getElementsByTagName('li')[0];
|
99258
|
+
item.focus();
|
99309
99259
|
}, 1);
|
99310
99260
|
};
|
99311
99261
|
|
99312
99262
|
_this.handleKeyDown = function (event) {
|
99313
99263
|
var nextItem;
|
99264
|
+
var key = keycode(event);
|
99314
99265
|
|
99315
|
-
if (
|
99266
|
+
if (key === 'down') {
|
99267
|
+
event.preventDefault();
|
99316
99268
|
nextItem = getNextItemSelectable(document.activeElement, 'down');
|
99317
|
-
} else if (
|
99269
|
+
} else if (key === 'up') {
|
99270
|
+
event.preventDefault();
|
99318
99271
|
nextItem = getNextItemSelectable(document.activeElement, 'up');
|
99319
|
-
} else if (
|
99320
|
-
/* if (!this.props.staticPosition) {
|
99321
|
-
document.body.style.overflow = 'auto';
|
99322
|
-
} */
|
99272
|
+
} else if (key === 'tab' || key === 'esc') {
|
99323
99273
|
_this.setState({
|
99324
99274
|
open: false
|
99325
99275
|
});
|
99326
|
-
} else if (
|
99327
|
-
|
99328
|
-
|
99276
|
+
} else if (key === 'space' || key === 'enter' && !_this.props.multiple) {
|
99277
|
+
event.preventDefault();
|
99278
|
+
|
99279
|
+
var item = _this.props.options.find(function (elem) {
|
99280
|
+
return String(elem.id) === event.target.id;
|
99329
99281
|
});
|
99282
|
+
|
99283
|
+
_this.handleSelect(null, item);
|
99284
|
+
} else if (key === 'enter' && _this.props.multiple) {
|
99285
|
+
event.preventDefault();
|
99286
|
+
|
99287
|
+
_this.handleClose();
|
99330
99288
|
}
|
99331
99289
|
|
99332
99290
|
if (nextItem) {
|
@@ -99335,10 +99293,14 @@
|
|
99335
99293
|
};
|
99336
99294
|
|
99337
99295
|
_this.handleKeyDownSearch = function (event) {
|
99338
|
-
|
99339
|
-
|
99340
|
-
|
99341
|
-
_this.
|
99296
|
+
var key = keycode(event);
|
99297
|
+
|
99298
|
+
if (_this.overlay && (key === 'down' || key === 'up')) {
|
99299
|
+
_this.focusOnFirstItem();
|
99300
|
+
} else if (_this.overlay && key === 'esc' || key === 'enter') {
|
99301
|
+
event.preventDefault();
|
99302
|
+
|
99303
|
+
_this.handleClose();
|
99342
99304
|
}
|
99343
99305
|
};
|
99344
99306
|
|
@@ -99355,426 +99317,273 @@
|
|
99355
99317
|
};
|
99356
99318
|
|
99357
99319
|
_this.handleClose = function () {
|
99320
|
+
_this.setState({
|
99321
|
+
open: false
|
99322
|
+
});
|
99323
|
+
|
99358
99324
|
if (_this.props.onClose) {
|
99359
99325
|
_this.props.onClose();
|
99360
99326
|
}
|
99361
99327
|
|
99362
|
-
if (_this.
|
99363
|
-
_this.
|
99328
|
+
if (_this.inputEl) {
|
99329
|
+
_this.inputEl.focus();
|
99364
99330
|
}
|
99365
|
-
|
99366
|
-
_this.setState({
|
99367
|
-
open: false
|
99368
|
-
});
|
99369
99331
|
};
|
99370
99332
|
|
99371
99333
|
_this.handleClickAway = function (event) {
|
99372
99334
|
// Au clic sur le bouton, on laisse le handleClick fermer le select
|
99373
|
-
if (!_this.
|
99335
|
+
if (!_this.inputEl.contains(event.target)) {
|
99374
99336
|
_this.handleClose(event);
|
99375
99337
|
}
|
99376
99338
|
};
|
99377
99339
|
|
99378
99340
|
_this.handleSelect = function (event, item) {
|
99379
99341
|
var _this$props = _this.props,
|
99342
|
+
hasAll = _this$props.hasAll,
|
99380
99343
|
multiple = _this$props.multiple,
|
99381
|
-
value = _this$props.value,
|
99382
99344
|
onChange = _this$props.onChange,
|
99383
99345
|
options = _this$props.options,
|
99384
|
-
|
99385
|
-
pinnedItem = _this$props.pinnedItem;
|
99386
|
-
var _this$state = _this.state,
|
99387
|
-
hierarchySelected = _this$state.hierarchySelected,
|
99388
|
-
hierarchy = _this$state.hierarchy,
|
99389
|
-
nbOptions = _this$state.nbOptions;
|
99390
|
-
|
99391
|
-
var hiSelected = _extends_1({}, hierarchySelected);
|
99392
|
-
|
99393
|
-
if (multiple) {
|
99394
|
-
var valueList = value;
|
99346
|
+
value = _this$props.value;
|
99395
99347
|
|
99396
|
-
|
99397
|
-
|
99398
|
-
|
99399
|
-
|
99400
|
-
if (hierarchic) {
|
99401
|
-
// if hierarchic select => empty associative array of selected children
|
99402
|
-
Object.keys(hiSelected).forEach(function (key) {
|
99403
|
-
hiSelected[key] = [];
|
99404
|
-
});
|
99405
|
-
}
|
99406
|
-
} else {
|
99407
|
-
options.forEach(function (option) {
|
99408
|
-
if (option.hasChildren !== true && !valueList.includes(option.id) && option.id !== '_all') {
|
99409
|
-
valueList.push(option.id);
|
99410
|
-
} else if (option.hasChildren === true) {
|
99411
|
-
// if hierarchic select => fill associative array of selected children
|
99412
|
-
hiSelected[option.id] = hierarchy[option.id];
|
99413
|
-
}
|
99414
|
-
});
|
99415
|
-
}
|
99416
|
-
} else if (valueList.includes(item.id) || item.hasChildren === true && hierarchySelected[item.id].length === hierarchy[item.id].length) {
|
99417
|
-
// item déjà sélectionné => on le déselectionne
|
99418
|
-
if (item.hasChildren !== true) {
|
99419
|
-
valueList = valueList.filter(function (val) {
|
99420
|
-
return val !== item.id;
|
99421
|
-
});
|
99422
|
-
}
|
99348
|
+
if (!multiple) {
|
99349
|
+
// single value
|
99350
|
+
_this.handleClose();
|
99423
99351
|
|
99424
|
-
|
99425
|
-
|
99426
|
-
|
99427
|
-
|
99428
|
-
|
99429
|
-
hiSelected[item.id] = [];
|
99430
|
-
} else if (item.hasOwnProperty('parentId')) {
|
99431
|
-
// Si item est un enfant on l'enlève du tableau associatif des
|
99432
|
-
// elmts sélectionnés
|
99433
|
-
hiSelected[item.parentId].splice(hiSelected[item.parentId].indexOf(item.id), 1);
|
99434
|
-
}
|
99352
|
+
onChange(event, item.id, item);
|
99353
|
+
} else if (hasAll && item.id === '_all') {
|
99354
|
+
if (value.length === options.length) {
|
99355
|
+
// unselect _all options
|
99356
|
+
onChange(event, [], item);
|
99435
99357
|
} else {
|
99436
|
-
|
99437
|
-
|
99438
|
-
|
99439
|
-
|
99440
|
-
});
|
99441
|
-
valueList = [item.id];
|
99442
|
-
} else {
|
99443
|
-
// item non sélectionné => on le sélectionne
|
99444
|
-
if (item.hasChildren !== true) valueList.push(item.id);
|
99445
|
-
|
99446
|
-
if (pinnedItem && valueList.includes(pinnedItem.id)) {
|
99447
|
-
valueList.splice(valueList.indexOf(pinnedItem.id), 1);
|
99448
|
-
}
|
99449
|
-
}
|
99450
|
-
|
99451
|
-
if (item.hasChildren === true) {
|
99452
|
-
// Si item parent => on ajoute tous les enfants
|
99453
|
-
// Ou on les supprime s'ils sont déjà tous sélectionnés (dans une liste filtrée)
|
99454
|
-
var idsInSuggestions = [];
|
99455
|
-
|
99456
|
-
_this.state.suggestions.forEach(function (suggestion) {
|
99457
|
-
if (_this.state.hierarchy[item.id].includes(suggestion.id)) {
|
99458
|
-
idsInSuggestions.push(suggestion.id);
|
99459
|
-
}
|
99460
|
-
}); // if(hierarchySelected[item.id].length > 0) {}
|
99461
|
-
|
99462
|
-
|
99463
|
-
var allChildrenSuggestionsSelected = true;
|
99464
|
-
idsInSuggestions.forEach(function (id) {
|
99465
|
-
if (!hierarchySelected[item.id].includes(id)) {
|
99466
|
-
allChildrenSuggestionsSelected = false;
|
99467
|
-
}
|
99468
|
-
});
|
99469
|
-
|
99470
|
-
if (allChildrenSuggestionsSelected === true) {
|
99471
|
-
// On supprime les enfants car déjà tous sélectionnés
|
99472
|
-
idsInSuggestions.forEach(function (id) {
|
99473
|
-
valueList.splice(valueList.indexOf(id), 1);
|
99474
|
-
hiSelected[item.id].splice(hiSelected[item.id].indexOf(id), 1);
|
99475
|
-
});
|
99476
|
-
} else {
|
99477
|
-
// On ajoute tous les enfants filtrés au éléments sélectionnés
|
99478
|
-
valueList = arrayUnique(valueList.concat(idsInSuggestions));
|
99479
|
-
hiSelected[item.id] = arrayUnique(hiSelected[item.id].concat(idsInSuggestions));
|
99480
|
-
}
|
99481
|
-
|
99482
|
-
_this.setState({
|
99483
|
-
hierarchySelected: hiSelected
|
99484
|
-
});
|
99485
|
-
} else if (item.hasOwnProperty('parentId')) {
|
99486
|
-
// Si item est un enfant on l'ajoute du tableau associatif des
|
99487
|
-
// elmts sélectionnés
|
99488
|
-
hiSelected[item.parentId].push(item.id);
|
99489
|
-
}
|
99358
|
+
// select _all options
|
99359
|
+
onChange(event, options.map(function (option) {
|
99360
|
+
return option.id;
|
99361
|
+
}), item);
|
99490
99362
|
}
|
99491
|
-
|
99492
|
-
|
99493
|
-
|
99494
|
-
|
99495
|
-
|
99496
|
-
onChange(event, valueList, item);
|
99363
|
+
} else if (value.includes(item.id)) {
|
99364
|
+
// unselect item
|
99365
|
+
onChange(event, value.filter(function (id) {
|
99366
|
+
return id !== item.id;
|
99367
|
+
}), item);
|
99497
99368
|
} else {
|
99498
|
-
onChange(event, item.id, item);
|
99499
|
-
|
99500
|
-
_this.handleClose();
|
99369
|
+
onChange(event, toConsumableArray(value).concat([item.id]), item);
|
99501
99370
|
}
|
99502
99371
|
};
|
99503
99372
|
|
99504
99373
|
_this.handleSuggestions = function (suggestions) {
|
99505
99374
|
var _this$props2 = _this.props,
|
99506
|
-
options = _this$props2.options,
|
99507
99375
|
hasAll = _this$props2.hasAll,
|
99508
99376
|
iconAll = _this$props2.iconAll,
|
99509
|
-
translations = _this$props2.translations
|
99510
|
-
multiple = _this$props2.multiple;
|
99377
|
+
translations = _this$props2.translations;
|
99511
99378
|
|
99512
99379
|
if (suggestions.length === 0) {
|
99513
|
-
//
|
99514
|
-
|
99515
|
-
|
99516
|
-
|
99517
|
-
|
99518
|
-
|
99519
|
-
|
99520
|
-
|
99521
|
-
|
99522
|
-
|
99380
|
+
// Add '_no_result' suggestion
|
99381
|
+
_this.setState(function (prevState) {
|
99382
|
+
return _extends_1({}, prevState, {
|
99383
|
+
suggestions: [{
|
99384
|
+
id: '_no_result',
|
99385
|
+
type: 'text',
|
99386
|
+
disabled: true,
|
99387
|
+
centered: true,
|
99388
|
+
hideCheckbox: true,
|
99389
|
+
label: translations.no_result_match
|
99390
|
+
}]
|
99391
|
+
});
|
99523
99392
|
});
|
99524
|
-
} else
|
99525
|
-
|
99526
|
-
|
99527
|
-
return suggestion.id === '_all';
|
99528
|
-
}).length === 0) {
|
99529
|
-
var allItem = {
|
99393
|
+
} else {
|
99394
|
+
_this.setState({
|
99395
|
+
suggestions: toConsumableArray(hasAll ? [_extends_1({
|
99530
99396
|
id: '_all',
|
99531
|
-
icon: iconAll,
|
99532
99397
|
label: translations.all
|
99533
|
-
}
|
99534
|
-
|
99535
|
-
|
99536
|
-
|
99537
|
-
|
99538
|
-
|
99539
|
-
suggestions.unshift(allItem);
|
99540
|
-
}
|
99398
|
+
}, iconAll && {
|
99399
|
+
type: 'icon',
|
99400
|
+
icon: iconAll
|
99401
|
+
})] : []).concat(toConsumableArray(suggestions))
|
99402
|
+
});
|
99541
99403
|
}
|
99542
|
-
|
99543
|
-
_this.setState({
|
99544
|
-
suggestions: suggestions
|
99545
|
-
});
|
99546
99404
|
};
|
99547
99405
|
|
99548
|
-
_this.
|
99549
|
-
|
99550
|
-
|
99551
|
-
|
99406
|
+
_this.handleScroll = function (e) {
|
99407
|
+
if (e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop < 15) {
|
99408
|
+
_this.props.onScrollReachBottom();
|
99409
|
+
}
|
99552
99410
|
};
|
99553
99411
|
|
99554
|
-
_this.
|
99555
|
-
|
99556
|
-
_this.props.loadMoreResults(_this.state.resultsPageNumber + 1);
|
99412
|
+
_this.handleSearch = function (e, inputValue) {
|
99413
|
+
var searchValue = inputValue && e.target.value ? inputValue : e.target.value;
|
99557
99414
|
|
99558
|
-
|
99559
|
-
|
99560
|
-
|
99561
|
-
|
99415
|
+
if (_this.props.onSearch) {
|
99416
|
+
_this.props.onSearch(e, searchValue);
|
99417
|
+
} else {
|
99418
|
+
_this.setState({
|
99419
|
+
searchValue: searchValue
|
99562
99420
|
});
|
99563
99421
|
}
|
99564
99422
|
};
|
99565
99423
|
|
99566
|
-
_this.
|
99567
|
-
|
99568
|
-
|
99569
|
-
|
99570
|
-
hierarchySelected: {},
|
99571
|
-
hierarchy: {},
|
99572
|
-
nbOptions: 0,
|
99573
|
-
dynamic: _props.dynamic || false,
|
99574
|
-
resultsPageNumber: 1
|
99575
|
-
}; // Check if value is in options
|
99576
|
-
|
99577
|
-
var valueInOptions = false;
|
99578
|
-
var _val = _props.value; // No options provided.
|
99579
|
-
|
99580
|
-
if (!_props.options.length || !_val || !_val.length) {
|
99581
|
-
valueInOptions = true;
|
99582
|
-
} else {
|
99583
|
-
// Check if an option match value prop.
|
99584
|
-
_props.options.forEach(function (item) {
|
99585
|
-
if (!valueInOptions && _val.indexOf(item.id) !== -1) {
|
99586
|
-
valueInOptions = true;
|
99587
|
-
}
|
99588
|
-
});
|
99589
|
-
|
99590
|
-
if (!valueInOptions && _props.pinnedItem) {
|
99591
|
-
if (_props.value.indexOf(_props.pinnedItem.id) >= 0) {
|
99592
|
-
valueInOptions = true;
|
99424
|
+
_this.handleSearchReset = function () {
|
99425
|
+
_this.handleSearch({
|
99426
|
+
target: {
|
99427
|
+
value: ''
|
99593
99428
|
}
|
99594
|
-
}
|
99595
|
-
}
|
99596
|
-
|
99597
|
-
if (!valueInOptions) {
|
99598
|
-
throw new Error('prop value provided does not match any option.');
|
99599
|
-
}
|
99429
|
+
}, '');
|
99430
|
+
};
|
99600
99431
|
|
99601
|
-
|
99602
|
-
var
|
99432
|
+
_this.buildSelectProps = function (options) {
|
99433
|
+
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
99434
|
+
var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
99435
|
+
var loading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
99436
|
+
|
99437
|
+
// build item list
|
99438
|
+
var itemList = toConsumableArray(loading ? [{
|
99439
|
+
id: '_loading',
|
99440
|
+
type: 'loader',
|
99441
|
+
disabled: true,
|
99442
|
+
centered: true,
|
99443
|
+
hideCheckbox: true,
|
99444
|
+
label: 'loading'
|
99445
|
+
}] : []).concat(toConsumableArray(search !== '' ? toConsumableArray(options.filter(function (item) {
|
99446
|
+
return item.label && foldAccents(item.label.toString().toLowerCase()).search(foldAccents(search.toLowerCase())) !== -1;
|
99447
|
+
})) : toConsumableArray(_this.props.hasAll ? [_extends_1({
|
99448
|
+
id: '_all',
|
99449
|
+
label: _this.props.translations.all
|
99450
|
+
}, _this.props.iconAll && {
|
99451
|
+
type: 'icon',
|
99452
|
+
icon: _this.props.iconAll
|
99453
|
+
})] : []).concat(toConsumableArray(options))));
|
99603
99454
|
|
99604
|
-
|
99605
|
-
|
99606
|
-
|
99455
|
+
return {
|
99456
|
+
itemList: itemList,
|
99457
|
+
inputValue: _this.buildInputValue(options, value, loading)
|
99458
|
+
};
|
99459
|
+
};
|
99607
99460
|
|
99608
|
-
|
99609
|
-
|
99610
|
-
var
|
99461
|
+
_this.buildInputValue = function (options) {
|
99462
|
+
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
99463
|
+
var loading = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
99464
|
+
var _this$props3 = _this.props,
|
99465
|
+
classes = _this$props3.classes,
|
99466
|
+
hasAll = _this$props3.hasAll,
|
99467
|
+
translations = _this$props3.translations,
|
99468
|
+
type = _this$props3.type; // build input value
|
99469
|
+
|
99470
|
+
var inputValue;
|
99471
|
+
|
99472
|
+
if (loading && value.length === 1) {
|
99473
|
+
inputValue = translations.one_item_selected;
|
99474
|
+
} else if (hasAll && options.length === value.length) {
|
99475
|
+
inputValue = translations.all;
|
99476
|
+
value.unshift('_all');
|
99477
|
+
} else if (value.length > 1) {
|
99478
|
+
inputValue = translations.n_items_selected.replace('%s', value.length);
|
99479
|
+
} else if (value.length === 1) {
|
99480
|
+
var item = options.find(function (o) {
|
99481
|
+
return o.id === value[0];
|
99482
|
+
});
|
99611
99483
|
|
99612
|
-
|
99613
|
-
|
99614
|
-
|
99484
|
+
if (item === undefined) {
|
99485
|
+
inputValue = translations.one_item_selected;
|
99486
|
+
} else if (type === 'icon' || item.type === 'icon') {
|
99487
|
+
inputValue = React__default.createElement("span", {
|
99488
|
+
className: classes.selectIconLabel
|
99489
|
+
}, React__default.createElement(HiIcon$1, {
|
99490
|
+
className: classes.labelIcon,
|
99491
|
+
icon: item.icon
|
99492
|
+
}), item.label);
|
99493
|
+
} else if (type === 'image' || item.type === 'image') {
|
99494
|
+
inputValue = React__default.createElement("span", {
|
99495
|
+
className: classes.selectIconLabel
|
99496
|
+
}, React__default.createElement("img", {
|
99497
|
+
className: classes.labelImg,
|
99498
|
+
src: item.img,
|
99499
|
+
alt: item.label
|
99500
|
+
}), item.label);
|
99501
|
+
} else {
|
99502
|
+
inputValue = item.label;
|
99615
99503
|
}
|
99616
|
-
}
|
99504
|
+
}
|
99617
99505
|
|
99618
|
-
|
99619
|
-
}
|
99620
|
-
_this.state.dynamic = true;
|
99621
|
-
}
|
99506
|
+
return inputValue;
|
99507
|
+
};
|
99622
99508
|
|
99623
|
-
_this.
|
99509
|
+
_this.state = {
|
99510
|
+
open: false,
|
99511
|
+
focused: false,
|
99512
|
+
searchValue: props.searchValue ? undefined : '',
|
99513
|
+
suggestions: props.options
|
99514
|
+
};
|
99624
99515
|
_this.handleClick = _this.handleClick.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99625
99516
|
_this.handleClose = _this.handleClose.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99626
99517
|
_this.handleClickAway = _this.handleClickAway.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99627
|
-
_this.handleRequestDelete = _this.handleRequestDelete.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99628
|
-
_this.handleSuggestions = _this.handleSuggestions.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99629
99518
|
_this.handleFocus = _this.handleFocus.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99630
99519
|
_this.handleBlur = _this.handleBlur.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99631
|
-
_this.
|
99520
|
+
_this.handleSearch = _this.handleSearch.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99521
|
+
_this.handleSearchReset = _this.handleSearchReset.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99522
|
+
_this.handleSelect = _this.handleSelect.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99523
|
+
_this.handleSuggestions = _this.handleSuggestions.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99524
|
+
_this.getInputElement = _this.getInputElement.bind(assertThisInitialized(assertThisInitialized(_this)));
|
99632
99525
|
return _this;
|
99633
99526
|
}
|
99634
99527
|
|
99635
99528
|
createClass(HiSelect, [{
|
99636
|
-
key: "
|
99637
|
-
value: function
|
99638
|
-
|
99639
|
-
this.handleSuggestions(nextProps.options);
|
99640
|
-
var optionsLength = 0;
|
99641
|
-
nextProps.options.forEach(function (option) {
|
99642
|
-
if (option.hasChildren !== true && option.id !== '_all') {
|
99643
|
-
optionsLength += 1;
|
99644
|
-
}
|
99645
|
-
});
|
99646
|
-
this.setState({
|
99647
|
-
nbOptions: optionsLength
|
99648
|
-
});
|
99649
|
-
}
|
99529
|
+
key: "getInputElement",
|
99530
|
+
value: function getInputElement(el) {
|
99531
|
+
this.searchField = el;
|
99650
99532
|
|
99651
|
-
if (
|
99652
|
-
|
99653
|
-
this.setState({
|
99654
|
-
hierarchy: hierarchyTrees.hierarchy,
|
99655
|
-
hierarchySelected: hierarchyTrees.hierarchySelected
|
99656
|
-
});
|
99657
|
-
}
|
99658
|
-
}
|
99659
|
-
}, {
|
99660
|
-
key: "handleReset",
|
99661
|
-
value: function handleReset(event) {
|
99662
|
-
if (this.props.onReset) {
|
99663
|
-
event.stopPropagation();
|
99664
|
-
this.props.onReset(event);
|
99533
|
+
if (this.props.inputRef) {
|
99534
|
+
this.props.inputRef(this.searchField);
|
99665
99535
|
}
|
99666
99536
|
}
|
99667
99537
|
}, {
|
99668
99538
|
key: "render",
|
99669
99539
|
value: function render() {
|
99670
|
-
var
|
99671
|
-
|
99672
|
-
var _this$props3 = this.props,
|
99673
|
-
classes = _this$props3.classes,
|
99674
|
-
disabled = _this$props3.disabled,
|
99675
|
-
error = _this$props3.error,
|
99676
|
-
loading = _this$props3.loading,
|
99677
|
-
options = _this$props3.options,
|
99678
|
-
searchable = _this$props3.searchable,
|
99679
|
-
displayAsChip = _this$props3.displayAsChip,
|
99680
|
-
type = _this$props3.type,
|
99681
|
-
value = _this$props3.value,
|
99682
|
-
translations = _this$props3.translations,
|
99683
|
-
parentItemSelectable = _this$props3.parentItemSelectable,
|
99684
|
-
icon = _this$props3.icon,
|
99685
|
-
parentIcon = _this$props3.parentIcon,
|
99686
|
-
hoverIcon = _this$props3.hoverIcon,
|
99687
|
-
checkedIcon = _this$props3.checkedIcon,
|
99688
|
-
id = _this$props3.id,
|
99689
|
-
placeholder = _this$props3.placeholder,
|
99690
|
-
staticPosition = _this$props3.staticPosition,
|
99691
|
-
pinnedItem = _this$props3.pinnedItem,
|
99692
|
-
hasAll = _this$props3.hasAll,
|
99693
|
-
infiniteScroll = _this$props3.infiniteScroll,
|
99694
|
-
loadingMoreResults = _this$props3.loadingMoreResults,
|
99695
|
-
multiple = _this$props3.multiple,
|
99696
|
-
other = objectWithoutProperties(_this$props3, ["classes", "disabled", "error", "loading", "options", "searchable", "displayAsChip", "type", "value", "translations", "parentItemSelectable", "icon", "parentIcon", "hoverIcon", "checkedIcon", "id", "placeholder", "staticPosition", "pinnedItem", "hasAll", "infiniteScroll", "loadingMoreResults", "multiple"]);
|
99697
|
-
|
99698
|
-
var _this$state2 = this.state,
|
99699
|
-
open = _this$state2.open,
|
99700
|
-
stateSuggestions = _this$state2.suggestions,
|
99701
|
-
focused = _this$state2.focused,
|
99702
|
-
dynamic = _this$state2.dynamic;
|
99703
|
-
var display = '';
|
99704
|
-
var selectedIdList;
|
99705
|
-
|
99706
|
-
if (Array.isArray(value)) {
|
99707
|
-
selectedIdList = value;
|
99708
|
-
} else if (value) {
|
99709
|
-
selectedIdList = [value];
|
99710
|
-
} else {
|
99711
|
-
selectedIdList = [];
|
99712
|
-
}
|
99713
|
-
|
99714
|
-
var suggestions = toConsumableArray(stateSuggestions);
|
99715
|
-
|
99716
|
-
if (pinnedItem) {
|
99717
|
-
suggestions.unshift(pinnedItem);
|
99718
|
-
} // If loading
|
99719
|
-
|
99720
|
-
|
99721
|
-
if (loading && !loadingMoreResults) {
|
99722
|
-
suggestions.unshift({
|
99723
|
-
id: '_loading',
|
99724
|
-
type: 'loader',
|
99725
|
-
disabled: true,
|
99726
|
-
centered: true,
|
99727
|
-
checkbox: false,
|
99728
|
-
label: 'loading'
|
99729
|
-
});
|
99730
|
-
}
|
99731
|
-
|
99732
|
-
if ((dynamic || loading) && selectedIdList.length === 1) {
|
99733
|
-
display = translations.one_item_selected;
|
99734
|
-
} else if ((this.state.nbOptions !== selectedIdList.length || !hasAll) && selectedIdList.length > 1) {
|
99735
|
-
display = translations.n_items_selected.replace('%s', selectedIdList.length);
|
99736
|
-
} else if (this.state.nbOptions === selectedIdList.length && this.state.nbOptions > 1) {
|
99737
|
-
display = translations.all;
|
99738
|
-
} else if (selectedIdList.length === 1) {
|
99739
|
-
var item = options.find(function (o) {
|
99740
|
-
return o.id === selectedIdList[0];
|
99741
|
-
});
|
99540
|
+
var _classNames,
|
99541
|
+
_this2 = this;
|
99742
99542
|
|
99743
|
-
|
99744
|
-
|
99745
|
-
|
99746
|
-
|
99747
|
-
|
99748
|
-
|
99543
|
+
var _this$props4 = this.props,
|
99544
|
+
classes = _this$props4.classes,
|
99545
|
+
disabled = _this$props4.disabled,
|
99546
|
+
error = _this$props4.error,
|
99547
|
+
loading = _this$props4.loading,
|
99548
|
+
options = _this$props4.options,
|
99549
|
+
searchable = _this$props4.searchable,
|
99550
|
+
displayAsChip = _this$props4.displayAsChip,
|
99551
|
+
type = _this$props4.type,
|
99552
|
+
value = _this$props4.value,
|
99553
|
+
multiple = _this$props4.multiple,
|
99554
|
+
translations = _this$props4.translations,
|
99555
|
+
hiSelectableListProps = _this$props4.hiSelectableListProps,
|
99556
|
+
hiSelectInputProps = _this$props4.hiSelectInputProps,
|
99557
|
+
id = _this$props4.id,
|
99558
|
+
onScrollReachBottom = _this$props4.onScrollReachBottom,
|
99559
|
+
onSubmit = _this$props4.onSubmit,
|
99560
|
+
placeholder = _this$props4.placeholder,
|
99561
|
+
startAdornment = _this$props4.startAdornment,
|
99562
|
+
staticPosition = _this$props4.staticPosition,
|
99563
|
+
_this$props4$searchVa = _this$props4.searchValue,
|
99564
|
+
searchValue = _this$props4$searchVa === void 0 ? this.state.searchValue : _this$props4$searchVa,
|
99565
|
+
_this$props4$buildSel = _this$props4.buildSelectProps,
|
99566
|
+
buildSelectProps = _this$props4$buildSel === void 0 ? this.buildSelectProps : _this$props4$buildSel;
|
99567
|
+
var _this$state = this.state,
|
99568
|
+
open = _this$state.open,
|
99569
|
+
focused = _this$state.focused;
|
99749
99570
|
|
99750
|
-
|
99751
|
-
|
99752
|
-
|
99753
|
-
className: classes.selectIconLabel
|
99754
|
-
}, React__default.createElement(HiIcon$1, {
|
99755
|
-
icon: item.icon,
|
99756
|
-
className: classes.labelIcon
|
99757
|
-
}), item.label);
|
99571
|
+
if (multiple) {
|
99572
|
+
if (!Array.isArray(value)) {
|
99573
|
+
throw new Error('HiPay Material-UI: the `value` property must be an array ' + 'when using the `HiSelect` component with `multiple`.');
|
99758
99574
|
}
|
99759
99575
|
}
|
99760
99576
|
|
99761
|
-
|
99762
|
-
var chipFilter = React__default.createElement(HiChip$1, {
|
99763
|
-
label: placeholder || display,
|
99764
|
-
onDelete: this.handleRequestDelete
|
99765
|
-
});
|
99577
|
+
var selectedItemIdList = [];
|
99766
99578
|
|
99767
|
-
|
99768
|
-
|
99769
|
-
}
|
99579
|
+
if (value) {
|
99580
|
+
selectedItemIdList = multiple ? toConsumableArray(value) : [value];
|
99770
99581
|
}
|
99771
99582
|
|
99772
|
-
var
|
99773
|
-
|
99774
|
-
|
99775
|
-
|
99776
|
-
allSelected = true;
|
99777
|
-
}
|
99583
|
+
var _buildSelectProps = buildSelectProps(options, selectedItemIdList, searchValue, loading),
|
99584
|
+
itemList = _buildSelectProps.itemList,
|
99585
|
+
_buildSelectProps$inp = _buildSelectProps.inputValue,
|
99586
|
+
inputValue = _buildSelectProps$inp === void 0 ? this.buildInputValue(options, selectedItemIdList, loading) : _buildSelectProps$inp;
|
99778
99587
|
|
99779
99588
|
var popperStyle = {};
|
99780
99589
|
|
@@ -99788,17 +99597,7 @@
|
|
99788
99597
|
}
|
99789
99598
|
}
|
99790
99599
|
|
99791
|
-
|
99792
|
-
suggestions.push({
|
99793
|
-
id: '_loading',
|
99794
|
-
type: 'loader',
|
99795
|
-
disabled: true,
|
99796
|
-
centered: true,
|
99797
|
-
checkbox: false,
|
99798
|
-
label: 'loading'
|
99799
|
-
});
|
99800
|
-
}
|
99801
|
-
|
99600
|
+
var popperClass = classnames(classes.popper, (_classNames = {}, defineProperty(_classNames, classes.popperWidth, !this.props.containerWidth), defineProperty(_classNames, classes.popperRightAlign, this.props.containerWidth && this.props.align === 'right'), _classNames));
|
99802
99601
|
var content = React__default.createElement(ClickAwayListener$2, {
|
99803
99602
|
onClickAway: this.handleClickAway
|
99804
99603
|
}, React__default.createElement(Grow$2, {
|
@@ -99809,48 +99608,41 @@
|
|
99809
99608
|
}
|
99810
99609
|
}, React__default.createElement(Paper$2, {
|
99811
99610
|
className: classes.paper
|
99812
|
-
}, !!searchable && React__default.createElement(
|
99813
|
-
|
99814
|
-
onFilteredList: this.handleSuggestions,
|
99815
|
-
filterPropertyList: ['label'],
|
99816
|
-
placeholder: translations.search,
|
99611
|
+
}, !!searchable && React__default.createElement(HiInput$1, {
|
99612
|
+
value: searchValue,
|
99817
99613
|
autoFocus: true,
|
99818
|
-
|
99819
|
-
|
99820
|
-
|
99821
|
-
|
99822
|
-
|
99823
|
-
|
99614
|
+
inputRef: this.getInputElement,
|
99615
|
+
onKeyDown: this.handleKeyDownSearch,
|
99616
|
+
onChange: this.handleSearch,
|
99617
|
+
onReset: this.handleSearchReset,
|
99618
|
+
placeholder: translations.search,
|
99619
|
+
startAdornment: 'search',
|
99620
|
+
tabIndex: 0
|
99621
|
+
}), startAdornment, React__default.createElement(Scrollbars, _extends_1({
|
99824
99622
|
ref: function ref(contentEl) {
|
99825
99623
|
_this2.optionsContent = contentEl;
|
99826
99624
|
},
|
99827
99625
|
autoHeight: true,
|
99828
|
-
autoHeightMax: 400
|
99626
|
+
autoHeightMax: 400 // TODO ?
|
99627
|
+
|
99628
|
+
}, onScrollReachBottom && {
|
99829
99629
|
onScroll: this.handleScroll
|
99830
|
-
}, React__default.createElement(HiSelectableList$1, _extends_1({
|
99630
|
+
}), React__default.createElement(HiSelectableList$1, _extends_1({
|
99831
99631
|
type: type,
|
99832
|
-
|
99833
|
-
|
99632
|
+
itemList: itemList,
|
99633
|
+
onKeyDown: this.handleKeyDown,
|
99834
99634
|
onSelect: this.handleSelect,
|
99835
|
-
selectedItemIdList:
|
99836
|
-
|
99837
|
-
|
99838
|
-
icon: icon,
|
99839
|
-
parentIcon: parentIcon,
|
99840
|
-
hoverIcon: hoverIcon,
|
99841
|
-
checkedIcon: checkedIcon,
|
99842
|
-
allSelected: allSelected,
|
99843
|
-
value: value,
|
99844
|
-
onKeyDown: this.handleKeyDown
|
99845
|
-
}, other))))));
|
99635
|
+
selectedItemIdList: selectedItemIdList,
|
99636
|
+
fallbackImage: this.props.fallbackImage
|
99637
|
+
}, hiSelectableListProps))))));
|
99846
99638
|
return React__default.createElement("div", {
|
99847
99639
|
className: classes.root,
|
99848
99640
|
ref: function ref(el) {
|
99849
99641
|
_this2.overlay = el;
|
99850
99642
|
}
|
99851
|
-
}, React__default.createElement(
|
99643
|
+
}, React__default.createElement(HiSelectInput$1, _extends_1({
|
99852
99644
|
id: id,
|
99853
|
-
value:
|
99645
|
+
value: inputValue,
|
99854
99646
|
open: open,
|
99855
99647
|
focused: focused,
|
99856
99648
|
type: type,
|
@@ -99860,43 +99652,55 @@
|
|
99860
99652
|
onClick: this.handleClick,
|
99861
99653
|
onFocus: this.handleFocus,
|
99862
99654
|
onBlur: this.handleBlur,
|
99655
|
+
onSubmit: onSubmit,
|
99863
99656
|
onMouseEnter: this.props.onMouseEnter,
|
99864
99657
|
onMouseLeave: this.props.onMouseLeave,
|
99658
|
+
onReset: this.props.onReset,
|
99659
|
+
placeholder: placeholder
|
99660
|
+
}, hiSelectInputProps, {
|
99865
99661
|
refElement: function refElement(el) {
|
99866
|
-
_this2.
|
99867
|
-
}
|
99868
|
-
|
99869
|
-
|
99870
|
-
|
99662
|
+
_this2.inputEl = el;
|
99663
|
+
}
|
99664
|
+
})), open && staticPosition ? React__default.createElement("div", {
|
99665
|
+
style: popperStyle,
|
99666
|
+
className: popperClass
|
99871
99667
|
}, content) : React__default.createElement(Popper$3, {
|
99872
99668
|
anchorEl: this.inputEl,
|
99873
99669
|
placement: "bottom-start",
|
99874
99670
|
open: open,
|
99875
99671
|
className: popperClass,
|
99876
|
-
|
99877
|
-
|
99672
|
+
disablePortal: true,
|
99673
|
+
style: popperStyle
|
99878
99674
|
}, content));
|
99879
99675
|
}
|
99676
|
+
}], [{
|
99677
|
+
key: "getDerivedStateFromProps",
|
99678
|
+
value: function getDerivedStateFromProps(nextProps, prevState) {
|
99679
|
+
if (nextProps.options !== prevState.suggestions) {
|
99680
|
+
return _extends_1({}, prevState, {
|
99681
|
+
suggestions: nextProps.options
|
99682
|
+
});
|
99683
|
+
}
|
99684
|
+
|
99685
|
+
return null;
|
99686
|
+
}
|
99880
99687
|
}]);
|
99881
99688
|
|
99882
99689
|
return HiSelect;
|
99883
99690
|
}(React__default.PureComponent);
|
99884
99691
|
|
99885
99692
|
HiSelect.defaultProps = {
|
99886
|
-
|
99693
|
+
align: 'left',
|
99887
99694
|
disabled: false,
|
99888
99695
|
displayAsChip: false,
|
99889
|
-
dynamic: false,
|
99890
99696
|
error: false,
|
99891
99697
|
hasAll: false,
|
99892
|
-
|
99893
|
-
|
99894
|
-
iconAll: false,
|
99895
|
-
infiniteScroll: false,
|
99896
|
-
loadingMoreResults: false,
|
99698
|
+
hiSelectableListProps: {},
|
99699
|
+
hiSelectInputProps: {},
|
99897
99700
|
multiple: false,
|
99898
|
-
|
99899
|
-
|
99701
|
+
placeholder: '',
|
99702
|
+
searchable: false,
|
99703
|
+
staticPosition: false,
|
99900
99704
|
translations: {
|
99901
99705
|
all: 'All',
|
99902
99706
|
no_result_match: 'No result match',
|
@@ -99906,14 +99710,10 @@
|
|
99906
99710
|
n_children: '%s items',
|
99907
99711
|
one_child: '%s item'
|
99908
99712
|
},
|
99909
|
-
|
99910
|
-
staticPosition: false
|
99713
|
+
type: 'text'
|
99911
99714
|
};
|
99912
99715
|
HiSelect.propTypes = {
|
99913
|
-
|
99914
|
-
* Icon affiché lorsque l'item est sélectionné
|
99915
|
-
*/
|
99916
|
-
checkedIcon: propTypes.node,
|
99716
|
+
align: propTypes.oneOf(['left', 'right']),
|
99917
99717
|
|
99918
99718
|
/**
|
99919
99719
|
* Useful to extend the style applied to components.
|
@@ -99935,77 +99735,46 @@
|
|
99935
99735
|
*/
|
99936
99736
|
displayAsChip: propTypes.bool,
|
99937
99737
|
|
99938
|
-
/**
|
99939
|
-
* Option permettant de définir si les options du select sont dynamiques.
|
99940
|
-
* Si les options du select sont initialisées à vide, alors ce sera mis à true
|
99941
|
-
* automatiquement.
|
99942
|
-
*/
|
99943
|
-
dynamic: propTypes.bool,
|
99944
|
-
|
99945
99738
|
/**
|
99946
99739
|
* Applique le style error
|
99947
99740
|
*/
|
99948
99741
|
error: propTypes.bool,
|
99949
99742
|
|
99950
99743
|
/**
|
99951
|
-
*
|
99952
|
-
*/
|
99953
|
-
hasAll: propTypes.bool,
|
99954
|
-
|
99955
|
-
/**
|
99956
|
-
* Indique si l'infinite scroll doit rechercher de nouveaux résultats
|
99744
|
+
* Chemin vers l'image à afficher par défaut si une image n'est pas trouvée
|
99957
99745
|
*/
|
99958
|
-
|
99746
|
+
fallbackImage: propTypes.string,
|
99959
99747
|
|
99960
99748
|
/**
|
99961
|
-
*
|
99749
|
+
* Affiche l'élément 'All'
|
99962
99750
|
*/
|
99963
|
-
|
99751
|
+
hasAll: propTypes.bool,
|
99964
99752
|
|
99965
99753
|
/**
|
99966
|
-
*
|
99754
|
+
* Override HiSelectableList props (
|
99967
99755
|
*/
|
99968
|
-
|
99756
|
+
hiSelectableListProps: propTypes.object,
|
99969
99757
|
|
99970
99758
|
/**
|
99971
|
-
*
|
99759
|
+
* Override HiSelectInput props
|
99972
99760
|
*/
|
99973
|
-
|
99761
|
+
hiSelectInputProps: propTypes.object,
|
99974
99762
|
|
99975
99763
|
/**
|
99976
99764
|
* Nom de l'icône
|
99977
99765
|
*/
|
99978
|
-
iconAll: propTypes.
|
99766
|
+
iconAll: propTypes.string,
|
99979
99767
|
|
99980
99768
|
/**
|
99981
99769
|
* id du select
|
99982
99770
|
*/
|
99983
99771
|
id: propTypes.string,
|
99984
99772
|
|
99985
|
-
/**
|
99986
|
-
* Infinite scroll dans le select dans le cas où il y a beaucoup de résultats à afficher
|
99987
|
-
* afin d'éviter un lag du navigateur
|
99988
|
-
*/
|
99989
|
-
infiniteScroll: propTypes.bool,
|
99990
|
-
|
99991
99773
|
/**
|
99992
99774
|
* Ajoute un loader
|
99993
99775
|
*/
|
99994
99776
|
loading: propTypes.bool,
|
99995
99777
|
|
99996
|
-
/**
|
99997
|
-
* Ajoute un loader en bas pour l'infiniteScroll
|
99998
|
-
*/
|
99999
|
-
loadingMoreResults: propTypes.bool,
|
100000
|
-
|
100001
|
-
/**
|
100002
|
-
* Fonction de callback appelée lorsque l'utilisateur arrive en bas de la liste des options
|
100003
|
-
* afin de charger les nouvelles options
|
100004
|
-
*
|
100005
|
-
* @param {int} pageNumber
|
100006
|
-
*/
|
100007
|
-
loadMoreResults: propTypes.func,
|
100008
|
-
|
100009
99778
|
/**
|
100010
99779
|
* Autorise la sélection de plusieurs valeurs
|
100011
99780
|
*/
|
@@ -100024,11 +99793,6 @@
|
|
100024
99793
|
*/
|
100025
99794
|
onChange: propTypes.func.isRequired,
|
100026
99795
|
|
100027
|
-
/**
|
100028
|
-
* Fonction de callback appelée click dans l'input
|
100029
|
-
*/
|
100030
|
-
onClick: propTypes.func,
|
100031
|
-
|
100032
99796
|
/**
|
100033
99797
|
* Fonction de callback appelée lorsqu'on ferme le select
|
100034
99798
|
*/
|
@@ -100050,18 +99814,14 @@
|
|
100050
99814
|
onReset: propTypes.func,
|
100051
99815
|
|
100052
99816
|
/**
|
100053
|
-
* Fonction de callback appelée
|
100054
|
-
* A utiliser pour les selects avec des données dynamiques
|
100055
|
-
*
|
100056
|
-
* @param {object} event
|
100057
|
-
* @param {string} value
|
99817
|
+
* Fonction de callback appelée lorsque le scroll atteint le bas de la liste
|
100058
99818
|
*/
|
100059
|
-
|
99819
|
+
onScrollReachBottom: propTypes.func,
|
100060
99820
|
|
100061
99821
|
/**
|
100062
|
-
* Fonction de callback
|
99822
|
+
* Fonction de callback appelée lorsque le champs de recherche est utilisé
|
100063
99823
|
*/
|
100064
|
-
|
99824
|
+
onSearch: propTypes.func,
|
100065
99825
|
|
100066
99826
|
/**
|
100067
99827
|
* Listes des options du select
|
@@ -100069,23 +99829,7 @@
|
|
100069
99829
|
options: propTypes.array.isRequired,
|
100070
99830
|
|
100071
99831
|
/**
|
100072
|
-
*
|
100073
|
-
*/
|
100074
|
-
parentIcon: propTypes.node,
|
100075
|
-
|
100076
|
-
/**
|
100077
|
-
* Les items parents sont sélectionnables
|
100078
|
-
*/
|
100079
|
-
parentItemSelectable: propTypes.bool,
|
100080
|
-
|
100081
|
-
/**
|
100082
|
-
* Item épinglé en début de liste
|
100083
|
-
*/
|
100084
|
-
pinnedItem: propTypes.object,
|
100085
|
-
|
100086
|
-
/**
|
100087
|
-
* Placeholder affiché lorsque le select est fermé
|
100088
|
-
* Surcharge le placeholder par défaut
|
99832
|
+
* Placeholder affiché lorsque l'input est vide
|
100089
99833
|
*/
|
100090
99834
|
placeholder: propTypes.string,
|
100091
99835
|
|
@@ -100095,7 +99839,12 @@
|
|
100095
99839
|
searchable: propTypes.bool,
|
100096
99840
|
|
100097
99841
|
/**
|
100098
|
-
*
|
99842
|
+
* Node qui s'ajoute entre la barre de recherche et la liste de résultats
|
99843
|
+
*/
|
99844
|
+
startAdornment: propTypes.object,
|
99845
|
+
|
99846
|
+
/**
|
99847
|
+
* Si true, le contenu du select sera dans une div static plutôt que dans une popper absolute
|
100099
99848
|
*/
|
100100
99849
|
staticPosition: propTypes.bool,
|
100101
99850
|
|
@@ -100250,6 +99999,8 @@
|
|
100250
99999
|
switch (key) {
|
100251
100000
|
case 'custom':
|
100252
100001
|
label = t.custom_period;
|
100002
|
+
from = moment().subtract(15, 'day').startOf('day');
|
100003
|
+
to = moment().endOf('day');
|
100253
100004
|
type = 'primary-highlight';
|
100254
100005
|
break;
|
100255
100006
|
|
@@ -100285,35 +100036,35 @@
|
|
100285
100036
|
label = t.current_month;
|
100286
100037
|
from = moment().startOf('month');
|
100287
100038
|
to = moment();
|
100288
|
-
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days'), " ").concat(t.days);
|
100039
|
+
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
100289
100040
|
break;
|
100290
100041
|
|
100291
100042
|
case 'pm':
|
100292
100043
|
label = t.previous_month;
|
100293
100044
|
from = moment().subtract(1, 'month').startOf('month');
|
100294
100045
|
to = moment().subtract(1, 'month').endOf('month');
|
100295
|
-
info = "".concat(from.format(
|
100046
|
+
info = "".concat(from.format(t.yearAndMonth), ", ").concat(from.daysInMonth(), " ").concat(t.days);
|
100296
100047
|
break;
|
100297
100048
|
|
100298
100049
|
case 'cq':
|
100299
100050
|
label = t.current_quarter;
|
100300
100051
|
from = moment().startOf('quarter');
|
100301
100052
|
to = moment();
|
100302
|
-
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days'), " ").concat(t.days);
|
100053
|
+
info = "".concat(from.format(t.yearAndQuarter), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
100303
100054
|
break;
|
100304
100055
|
|
100305
100056
|
case 'pq':
|
100306
100057
|
label = t.previous_quarter;
|
100307
100058
|
from = moment().subtract(1, 'quarter').startOf('quarter');
|
100308
100059
|
to = moment().subtract(1, 'quarter').endOf('quarter');
|
100309
|
-
info = "".concat(from.format(
|
100060
|
+
info = "".concat(from.format(t.yearAndQuarter), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
100310
100061
|
break;
|
100311
100062
|
|
100312
100063
|
case 'cy':
|
100313
100064
|
label = t.current_year;
|
100314
100065
|
from = moment().startOf('year');
|
100315
100066
|
to = moment();
|
100316
|
-
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days'), " ").concat(t.days);
|
100067
|
+
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
100317
100068
|
break;
|
100318
100069
|
|
100319
100070
|
default:
|
@@ -100361,25 +100112,30 @@
|
|
100361
100112
|
_this = possibleConstructorReturn(this, getPrototypeOf(HiDateRangeSelector).call(this));
|
100362
100113
|
_this.options = [];
|
100363
100114
|
|
100115
|
+
_this.onBlur = function (event) {
|
100116
|
+
if (event instanceof Object && _this.props.onblur) {
|
100117
|
+
_this.props.onBlur(event);
|
100118
|
+
}
|
100119
|
+
};
|
100120
|
+
|
100364
100121
|
_this.handleSelectChange = function (name) {
|
100365
100122
|
return function (event, value) {
|
100366
|
-
_this
|
100123
|
+
var _this$setState;
|
100367
100124
|
|
100368
|
-
|
100369
|
-
var selectedOption = _this.options.find(function (option) {
|
100370
|
-
return option.id === value;
|
100371
|
-
});
|
100125
|
+
_this.setState((_this$setState = {}, defineProperty(_this$setState, name, value), defineProperty(_this$setState, "key", _this.state.key === 1 ? 2 : 1), _this$setState));
|
100372
100126
|
|
100373
|
-
|
100374
|
-
|
100127
|
+
var selectedOption = _this.options.find(function (option) {
|
100128
|
+
return option.id === value;
|
100129
|
+
});
|
100375
100130
|
|
100376
|
-
|
100377
|
-
|
100378
|
-
|
100379
|
-
_this.
|
100380
|
-
|
100381
|
-
|
100382
|
-
|
100131
|
+
if (selectedOption) {
|
100132
|
+
_this.props.onChange('from', selectedOption.from.toDate());
|
100133
|
+
|
100134
|
+
_this.props.onChange('to', selectedOption.to.toDate());
|
100135
|
+
|
100136
|
+
_this.props.onChange('fromError', false);
|
100137
|
+
|
100138
|
+
_this.props.onChange('toError', false);
|
100383
100139
|
}
|
100384
100140
|
|
100385
100141
|
if (_this.props.returnSelectValue === true) {
|
@@ -100393,25 +100149,9 @@
|
|
100393
100149
|
_this.options = props.availableOptionKeys.map(function (key) {
|
100394
100150
|
return buildDateRangeOptionByKey(key, props.translations, props.format);
|
100395
100151
|
});
|
100396
|
-
var from;
|
100397
|
-
var to;
|
100398
|
-
|
100399
|
-
if (props.defaultPreset !== 'custom') {
|
100400
|
-
var selectedOption = _this.options.find(function (option) {
|
100401
|
-
return option.id === props.defaultPreset;
|
100402
|
-
});
|
100403
|
-
|
100404
|
-
if (selectedOption) {
|
100405
|
-
from = selectedOption.from.toDate();
|
100406
|
-
to = selectedOption.to.toDate();
|
100407
|
-
}
|
100408
|
-
}
|
100409
|
-
|
100410
100152
|
_this.state = {
|
100411
100153
|
selectedPreset: props.defaultPreset,
|
100412
|
-
containerWidth: 0
|
100413
|
-
defaultFrom: from,
|
100414
|
-
defaultTo: to
|
100154
|
+
containerWidth: 0
|
100415
100155
|
};
|
100416
100156
|
return _this;
|
100417
100157
|
}
|
@@ -100421,8 +100161,9 @@
|
|
100421
100161
|
value: function componentDidMount() {
|
100422
100162
|
if (this.container) {
|
100423
100163
|
this.setState({
|
100424
|
-
containerWidth: require$$11.findDOMNode(this.container).clientWidth
|
100164
|
+
containerWidth: require$$11.findDOMNode(this.container).clientWidth - 5
|
100425
100165
|
});
|
100166
|
+
this.handleSelectChange('selectedPreset')(undefined, this.state.selectedPreset);
|
100426
100167
|
}
|
100427
100168
|
}
|
100428
100169
|
}, {
|
@@ -100434,6 +100175,7 @@
|
|
100434
100175
|
key: "handleReset",
|
100435
100176
|
value: function handleReset(name) {
|
100436
100177
|
this.props.onChange(name, undefined);
|
100178
|
+
this.props.onChange("".concat(name, "Error"), undefined);
|
100437
100179
|
}
|
100438
100180
|
}, {
|
100439
100181
|
key: "render",
|
@@ -100443,12 +100185,14 @@
|
|
100443
100185
|
var _this$props = this.props,
|
100444
100186
|
disabled = _this$props.disabled,
|
100445
100187
|
enableTime = _this$props.enableTime,
|
100446
|
-
error = _this$props.error,
|
100447
100188
|
errorText = _this$props.errorText,
|
100189
|
+
fromError = _this$props.fromError,
|
100190
|
+
toError = _this$props.toError,
|
100448
100191
|
helperIcon = _this$props.helperIcon,
|
100449
100192
|
helperText = _this$props.helperText,
|
100450
100193
|
idRange = _this$props.idRange,
|
100451
100194
|
idSelect = _this$props.idSelect,
|
100195
|
+
minimumDate = _this$props.minimumDate,
|
100452
100196
|
label = _this$props.label,
|
100453
100197
|
from = _this$props.from,
|
100454
100198
|
onChange = _this$props.onChange,
|
@@ -100458,18 +100202,25 @@
|
|
100458
100202
|
classes = _this$props.classes,
|
100459
100203
|
selectProps = _this$props.selectProps,
|
100460
100204
|
staticPosition = _this$props.staticPosition,
|
100461
|
-
props = objectWithoutProperties(_this$props, ["disabled", "enableTime", "
|
100205
|
+
props = objectWithoutProperties(_this$props, ["disabled", "enableTime", "errorText", "fromError", "toError", "helperIcon", "helperText", "idRange", "idSelect", "minimumDate", "label", "from", "onChange", "required", "to", "translations", "classes", "selectProps", "staticPosition"]);
|
100462
100206
|
|
100463
|
-
var
|
100464
|
-
|
100465
|
-
|
100466
|
-
|
100467
|
-
return React__default.createElement(
|
100207
|
+
var selectedPreset = this.state.selectedPreset;
|
100208
|
+
var hiSelectableListProps = {
|
100209
|
+
hideCheckbox: true
|
100210
|
+
};
|
100211
|
+
return React__default.createElement(HiFormControl$1, {
|
100212
|
+
disabled: disabled,
|
100213
|
+
helperIcon: helperIcon,
|
100214
|
+
helperText: helperText,
|
100215
|
+
errorText: errorText,
|
100216
|
+
error: !!(fromError || toError),
|
100217
|
+
label: ' '
|
100218
|
+
}, React__default.createElement(Grid$4, {
|
100468
100219
|
container: true,
|
100469
100220
|
spacing: 8,
|
100470
100221
|
className: classes.root,
|
100471
100222
|
ref: function ref(container) {
|
100472
|
-
_this2.container = container;
|
100223
|
+
return _this2.container = container;
|
100473
100224
|
}
|
100474
100225
|
}, React__default.createElement(Grid$4, {
|
100475
100226
|
item: true,
|
@@ -100480,12 +100231,10 @@
|
|
100480
100231
|
}
|
100481
100232
|
}, React__default.createElement(HiSelectField, _extends_1({
|
100482
100233
|
disabled: disabled,
|
100483
|
-
error: error,
|
100484
|
-
errorText: errorText,
|
100485
|
-
helperIcon: helperIcon,
|
100486
|
-
helperText: helperText,
|
100487
100234
|
id: idSelect,
|
100488
100235
|
label: label,
|
100236
|
+
hideCheckbox: true,
|
100237
|
+
hiSelectableListProps: hiSelectableListProps,
|
100489
100238
|
name: 'selectedPreset',
|
100490
100239
|
options: this.options,
|
100491
100240
|
onChange: this.handleSelectChange('selectedPreset'),
|
@@ -100505,19 +100254,26 @@
|
|
100505
100254
|
'grid-sm-8': classes.smRangePicker
|
100506
100255
|
}
|
100507
100256
|
}, React__default.createElement(HiDateRangePicker$1, _extends_1({
|
100257
|
+
key: this.state.key,
|
100508
100258
|
classes: {
|
100509
100259
|
root: classes.dateRangePicker
|
100510
100260
|
},
|
100511
100261
|
id: idRange,
|
100512
|
-
from: from
|
100513
|
-
to: to
|
100262
|
+
from: from,
|
100263
|
+
to: to,
|
100514
100264
|
enableTime: enableTime,
|
100515
100265
|
onChange: onChange,
|
100266
|
+
toError: toError,
|
100267
|
+
fromError: fromError,
|
100268
|
+
minimumDate: minimumDate,
|
100269
|
+
errorText: null,
|
100516
100270
|
onReset: this.handleReset,
|
100517
100271
|
disabled: disabled || selectedPreset !== 'custom',
|
100518
100272
|
translations: translations,
|
100519
|
-
staticPosition: staticPosition
|
100520
|
-
|
100273
|
+
staticPosition: staticPosition,
|
100274
|
+
onBlur: this.onBlur,
|
100275
|
+
hasSelector: true
|
100276
|
+
}, props)))));
|
100521
100277
|
}
|
100522
100278
|
}], [{
|
100523
100279
|
key: "getDerivedStateFromProps",
|
@@ -100551,7 +100307,8 @@
|
|
100551
100307
|
quarter: 'Quarter',
|
100552
100308
|
week: 'Week',
|
100553
100309
|
short_week: 'W',
|
100554
|
-
|
100310
|
+
yearAndMonth: 'YYYY[-]MM',
|
100311
|
+
yearAndQuarter: 'YYYY[-Q]Q',
|
100555
100312
|
year: 'Year',
|
100556
100313
|
days: 'days',
|
100557
100314
|
custom_period: 'Custom Period',
|
@@ -100564,7 +100321,13 @@
|
|
100564
100321
|
previous_month: 'Previous Month',
|
100565
100322
|
current_quarter: 'Current Quarter',
|
100566
100323
|
previous_quarter: 'Previous Quarter',
|
100567
|
-
current_year: 'Current Year'
|
100324
|
+
current_year: 'Current Year',
|
100325
|
+
invalid_format: 'The date format is not valid',
|
100326
|
+
to_superior_from: 'Date from cannot be greater than date to',
|
100327
|
+
date_superior_max_date: 'Date from cannot be greater than %s',
|
100328
|
+
date_inferior_min_date: 'Date from cannot be before than %s',
|
100329
|
+
missing_date_from: 'Missing date from',
|
100330
|
+
missing_date_to: 'Missing date to'
|
100568
100331
|
}
|
100569
100332
|
};
|
100570
100333
|
HiDateRangeSelector.propTypes = {
|
@@ -100601,7 +100364,7 @@
|
|
100601
100364
|
/**
|
100602
100365
|
* Texte de l'erreur
|
100603
100366
|
*/
|
100604
|
-
errorText: propTypes.string,
|
100367
|
+
errorText: propTypes.oneOfType([propTypes.string, propTypes.bool]),
|
100605
100368
|
|
100606
100369
|
/**
|
100607
100370
|
* Format de date utilisé
|
@@ -100643,6 +100406,11 @@
|
|
100643
100406
|
*/
|
100644
100407
|
locale: propTypes.string,
|
100645
100408
|
|
100409
|
+
/**
|
100410
|
+
* Date minimale sélectionnable
|
100411
|
+
*/
|
100412
|
+
minimumDate: propTypes.instanceOf(Date).isRequired,
|
100413
|
+
|
100646
100414
|
/**
|
100647
100415
|
* Callback à la sélection d'une date
|
100648
100416
|
*/
|