@hipay/hipay-material-ui 2.0.0-beta.58 → 2.0.0-beta.60
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +117 -0
- package/HiCell/CellNumeric.js +1 -1
- package/HiColoredLabel/HiColoredLabel.js +16 -4
- package/HiDatePicker/HiDatePicker.js +11 -2
- package/HiDatePicker/HiDateRangePicker.js +49 -8
- package/HiDatePicker/HiDateRangeSelector.js +39 -30
- package/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/HiForm/HiFormControl.js +26 -11
- package/HiForm/HiFormLabel.js +3 -1
- package/HiForm/HiInput.js +33 -1
- package/HiForm/HiUpload.js +290 -45
- package/HiForm/HiUploadField.js +19 -51
- package/HiForm/HiUploadInput.js +18 -7
- package/HiSelect/HiSuggestSelect.js +3 -3
- package/HiSelectNew/HiDynamicSelect.js +3 -3
- package/HiSelectNew/HiNestedSelect.js +29 -15
- package/HiSelectNew/HiNestedSelectContent.js +29 -15
- package/HiSelectNew/HiSelect.js +23 -12
- package/HiSelectNew/HiSelectContent.js +23 -11
- package/HiSelectNew/HiSelectInput.js +4 -4
- package/HiSelectableList/HiSelectableListItem.js +8 -10
- package/README.md +1 -1
- package/es/HiCell/CellNumeric.js +1 -1
- package/es/HiColoredLabel/HiColoredLabel.js +21 -4
- package/es/HiDatePicker/HiDatePicker.js +11 -2
- package/es/HiDatePicker/HiDateRangePicker.js +42 -8
- package/es/HiDatePicker/HiDateRangeSelector.js +38 -27
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +8 -3
- package/es/HiForm/HiFormControl.js +27 -11
- package/es/HiForm/HiFormLabel.js +3 -1
- package/es/HiForm/HiInput.js +32 -1
- package/es/HiForm/HiUpload.js +276 -35
- package/es/HiForm/HiUploadField.js +19 -43
- package/es/HiForm/HiUploadInput.js +16 -7
- package/es/HiSelect/HiSuggestSelect.js +3 -3
- package/es/HiSelectNew/HiNestedSelect.js +17 -7
- package/es/HiSelectNew/HiNestedSelectContent.js +16 -6
- package/es/HiSelectNew/HiSelect.js +15 -3
- package/es/HiSelectNew/HiSelectContent.js +11 -2
- package/es/HiSelectNew/HiSelectInput.js +4 -3
- package/es/HiSelectableList/HiSelectableListItem.js +8 -10
- package/es/utils/helpers.js +6 -5
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -2
- package/umd/hipay-material-ui.development.js +4632 -1923
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +6 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,120 @@
|
|
1
|
+
# [2.0.0-beta.60](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.60) (2019-01-14)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
|
7
|
+
* **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
|
8
|
+
* **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
|
9
|
+
* **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
|
10
|
+
* **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
|
11
|
+
* **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
|
12
|
+
* **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
|
13
|
+
* **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
|
14
|
+
* **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
|
15
|
+
* **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
|
16
|
+
* **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
|
17
|
+
* **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
|
18
|
+
* **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
|
19
|
+
* **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
|
20
|
+
* **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
|
21
|
+
* **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
|
22
|
+
|
23
|
+
|
24
|
+
### Features
|
25
|
+
|
26
|
+
* **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
|
27
|
+
* **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
|
28
|
+
* **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
|
29
|
+
* **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
|
30
|
+
* **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
|
31
|
+
* **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
|
32
|
+
* **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
|
33
|
+
* **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
|
34
|
+
* **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
|
35
|
+
* **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
|
36
|
+
* **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
|
37
|
+
* **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
|
38
|
+
* **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
|
39
|
+
* **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
|
40
|
+
* **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
|
41
|
+
* **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
|
42
|
+
|
43
|
+
|
44
|
+
### Performance Improvements
|
45
|
+
|
46
|
+
* **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
|
47
|
+
|
48
|
+
|
49
|
+
### BREAKING CHANGES
|
50
|
+
|
51
|
+
* **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
|
52
|
+
* **HiUploadField:** Components names changes
|
53
|
+
* **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
|
54
|
+
CellImage & CellText)
|
55
|
+
* **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
<a name="2.0.0-beta.59"></a>
|
60
|
+
# [2.0.0-beta.59](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.59) (2018-12-27)
|
61
|
+
|
62
|
+
|
63
|
+
### Bug Fixes
|
64
|
+
|
65
|
+
* **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
|
66
|
+
* **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
|
67
|
+
* **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
|
68
|
+
* **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
|
69
|
+
* **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
|
70
|
+
* **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
|
71
|
+
* **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
|
72
|
+
* **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
|
73
|
+
* **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
|
74
|
+
* **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
|
75
|
+
* **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
|
76
|
+
* **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
|
77
|
+
* **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
|
78
|
+
* **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
|
79
|
+
* **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
|
80
|
+
* **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
|
81
|
+
|
82
|
+
|
83
|
+
### Features
|
84
|
+
|
85
|
+
* **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
|
86
|
+
* **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
|
87
|
+
* **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
|
88
|
+
* **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
|
89
|
+
* **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
|
90
|
+
* **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
|
91
|
+
* **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
|
92
|
+
* **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
|
93
|
+
* **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
|
94
|
+
* **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
|
95
|
+
* **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
|
96
|
+
* **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
|
97
|
+
* **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
|
98
|
+
* **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
|
99
|
+
* **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
|
100
|
+
* **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
|
101
|
+
|
102
|
+
|
103
|
+
### Performance Improvements
|
104
|
+
|
105
|
+
* **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
|
106
|
+
|
107
|
+
|
108
|
+
### BREAKING CHANGES
|
109
|
+
|
110
|
+
* **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
|
111
|
+
* **HiUploadField:** Components names changes
|
112
|
+
* **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
|
113
|
+
CellImage & CellText)
|
114
|
+
* **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
|
115
|
+
|
116
|
+
|
117
|
+
|
1
118
|
# [2.0.0-beta.58](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.58) (2018-12-13)
|
2
119
|
|
3
120
|
|
package/HiCell/CellNumeric.js
CHANGED
@@ -63,7 +63,7 @@ function (_React$PureComponent) {
|
|
63
63
|
var title = '';
|
64
64
|
|
65
65
|
if (currency) {
|
66
|
-
displayedValue = (0, _helpers.formatCurrencyAmount)(value, view, locale, currency);
|
66
|
+
displayedValue = (0, _helpers.formatCurrencyAmount)(value, view, locale, currency, precision);
|
67
67
|
title = (0, _helpers.formatCurrencyAmount)(value, 'l', locale, currency);
|
68
68
|
} else {
|
69
69
|
displayedValue = (0, _helpers.formatNumber)(value, view, locale, precision);
|
@@ -27,7 +27,7 @@ var _colorManipulator = require("../styles/colorManipulator");
|
|
27
27
|
|
28
28
|
var styles = function styles(theme) {
|
29
29
|
return {
|
30
|
-
root:
|
30
|
+
root: {
|
31
31
|
display: 'inline-block',
|
32
32
|
alignItems: 'baseline',
|
33
33
|
maxWidth: '100%',
|
@@ -37,7 +37,12 @@ var styles = function styles(theme) {
|
|
37
37
|
overflow: 'hidden',
|
38
38
|
whiteSpace: 'nowrap',
|
39
39
|
lineHeight: 1
|
40
|
-
}
|
40
|
+
},
|
41
|
+
body1: (0, _extends2.default)({}, theme.typography.b1),
|
42
|
+
body2: (0, _extends2.default)({}, theme.typography.b2),
|
43
|
+
body3: (0, _extends2.default)({}, theme.typography.b3),
|
44
|
+
body4: (0, _extends2.default)({}, theme.typography.b4),
|
45
|
+
body5: (0, _extends2.default)({}, theme.typography.b5),
|
41
46
|
color: {
|
42
47
|
fontWeight: 400
|
43
48
|
},
|
@@ -135,6 +140,7 @@ function HiColoredLabel(props) {
|
|
135
140
|
|
136
141
|
var classes = props.classes,
|
137
142
|
className = props.className,
|
143
|
+
fontSize = props.fontSize,
|
138
144
|
label = props.label,
|
139
145
|
color = props.color,
|
140
146
|
active = props.active,
|
@@ -142,11 +148,11 @@ function HiColoredLabel(props) {
|
|
142
148
|
fontWeight = props.fontWeight,
|
143
149
|
style = props.style,
|
144
150
|
theme = props.theme,
|
145
|
-
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
151
|
+
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "fontSize", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
146
152
|
var isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
147
153
|
var isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
148
154
|
return _react.default.createElement("div", (0, _extends2.default)({
|
149
|
-
className: (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.color, !active), (0, _defineProperty2.default)(_classNames, classes.activeColor, active), (0, _defineProperty2.default)(_classNames, classes.outlined, outlined), (0, _defineProperty2.default)(_classNames, classes["activeColor".concat((0, _helpers.capitalize)(color))], active && isHiColor), (0, _defineProperty2.default)(_classNames, classes["color".concat((0, _helpers.capitalize)(color))], !active && isHiColor), _classNames), className),
|
155
|
+
className: (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.color, !active), (0, _defineProperty2.default)(_classNames, classes.activeColor, active), (0, _defineProperty2.default)(_classNames, classes.outlined, outlined), (0, _defineProperty2.default)(_classNames, classes["activeColor".concat((0, _helpers.capitalize)(color))], active && isHiColor), (0, _defineProperty2.default)(_classNames, classes["color".concat((0, _helpers.capitalize)(color))], !active && isHiColor), (0, _defineProperty2.default)(_classNames, classes.body1, fontSize >= 15), (0, _defineProperty2.default)(_classNames, classes.body2, fontSize === 14), (0, _defineProperty2.default)(_classNames, classes.body3, fontSize === 13), (0, _defineProperty2.default)(_classNames, classes.body4, fontSize === 12), (0, _defineProperty2.default)(_classNames, classes.body5, fontSize <= 11), _classNames), className),
|
150
156
|
style: (0, _extends2.default)({}, style, isHexColor && {
|
151
157
|
backgroundColor: active ? color : (0, _colorManipulator.fade)(color, 0.08),
|
152
158
|
color: active ? theme.palette.getContrastText(color) : color
|
@@ -178,6 +184,11 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
178
184
|
*/
|
179
185
|
color: _propTypes.default.string,
|
180
186
|
|
187
|
+
/**
|
188
|
+
* Taille du text
|
189
|
+
*/
|
190
|
+
fontSize: _propTypes.default.number,
|
191
|
+
|
181
192
|
/**
|
182
193
|
* Graisse du text
|
183
194
|
*/
|
@@ -196,6 +207,7 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
196
207
|
HiColoredLabel.defaultProps = {
|
197
208
|
active: false,
|
198
209
|
color: 'primary',
|
210
|
+
fontSize: 15,
|
199
211
|
outlined: false
|
200
212
|
};
|
201
213
|
|
@@ -232,7 +232,8 @@ function (_React$Component) {
|
|
232
232
|
value: function renderYearPickerOverlay(propsOverlay) {
|
233
233
|
var yearPickerProps = {
|
234
234
|
value: this.state.currentMonth,
|
235
|
-
onChange: this.handleCurrentMonthChange
|
235
|
+
onChange: this.handleCurrentMonthChange,
|
236
|
+
disableFutureDays: this.props.disableFutureDays
|
236
237
|
};
|
237
238
|
return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
|
238
239
|
key: 'year-picker-overlay'
|
@@ -299,7 +300,10 @@ function (_React$Component) {
|
|
299
300
|
var inputProps = (0, _extends2.default)({}, onReset && {
|
300
301
|
onReset: this.handleReset
|
301
302
|
}, props, {
|
302
|
-
onChange: this.handleInputChange
|
303
|
+
onChange: this.handleInputChange,
|
304
|
+
HiInputProps: {
|
305
|
+
onSubmit: this.props.onSubmit
|
306
|
+
}
|
303
307
|
});
|
304
308
|
return _react.default.createElement("div", {
|
305
309
|
className: classes.root
|
@@ -397,6 +401,11 @@ HiDatePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
397
401
|
*/
|
398
402
|
onReset: _propTypes.default.func,
|
399
403
|
|
404
|
+
/**
|
405
|
+
* Callback lorsque l'utilisateur tape sur "Entrée"
|
406
|
+
*/
|
407
|
+
onSubmit: _propTypes.default.func,
|
408
|
+
|
400
409
|
/**
|
401
410
|
* Traductions
|
402
411
|
*/
|
@@ -225,6 +225,36 @@ function (_React$Component) {
|
|
225
225
|
});
|
226
226
|
};
|
227
227
|
|
228
|
+
_this.handleKeyDown = function (name) {
|
229
|
+
return function (event) {
|
230
|
+
if (event.key === 'Tab' && !event.shiftKey) {
|
231
|
+
var nodeName = document.activeElement.nodeName;
|
232
|
+
|
233
|
+
if (_this.props[name] && nodeName === 'INPUT' && document.activeElement.nextSibling.children.length > 0) {
|
234
|
+
document.activeElement.nextSibling.focus();
|
235
|
+
} else if (name === 'from') {
|
236
|
+
_this.handleDayPickerBlur('from');
|
237
|
+
|
238
|
+
_this.handleDayPickerFocus('to');
|
239
|
+
|
240
|
+
_this.toInput.handleInputFocus();
|
241
|
+
|
242
|
+
setTimeout(function () {
|
243
|
+
document.getElementById("".concat(_this.props.id, "-to")).focus();
|
244
|
+
}, 1);
|
245
|
+
} else if (name === 'to') {
|
246
|
+
_this.handleDayPickerBlur('to');
|
247
|
+
|
248
|
+
_this.toInput.handleInputBlur(event);
|
249
|
+
|
250
|
+
setTimeout(function () {
|
251
|
+
document.activeElement.blur();
|
252
|
+
}, 1);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
};
|
256
|
+
};
|
257
|
+
|
228
258
|
_this.openPanel = function (panel) {
|
229
259
|
_this.setState({
|
230
260
|
openedPanel: panel
|
@@ -310,7 +340,7 @@ function (_React$Component) {
|
|
310
340
|
var yearPickerProps = {
|
311
341
|
value: _this.state.currentMonth,
|
312
342
|
onChange: _this.handleCurrentMonthChange,
|
313
|
-
|
343
|
+
disableFutureDays: _this.props.disableFutureDays
|
314
344
|
};
|
315
345
|
return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
|
316
346
|
key: "".concat(name, "-year-picker-overlay")
|
@@ -452,7 +482,10 @@ function (_React$Component) {
|
|
452
482
|
}, {
|
453
483
|
id: "".concat(id, "-from"),
|
454
484
|
onChange: this.handleInputChange('from'),
|
455
|
-
disabled: disabled
|
485
|
+
disabled: disabled,
|
486
|
+
HiInputProps: {
|
487
|
+
onSubmit: this.props.onSubmit
|
488
|
+
}
|
456
489
|
});
|
457
490
|
var toInputProps = (0, _extends2.default)({}, onReset && {
|
458
491
|
onReset: function onReset() {
|
@@ -465,7 +498,10 @@ function (_React$Component) {
|
|
465
498
|
}, {
|
466
499
|
id: "".concat(id, "-to"),
|
467
500
|
onChange: this.handleInputChange('to'),
|
468
|
-
disabled: disabled
|
501
|
+
disabled: disabled,
|
502
|
+
HiInputProps: {
|
503
|
+
onSubmit: this.props.onSubmit
|
504
|
+
}
|
469
505
|
});
|
470
506
|
var toClass = (0, _classnames.default)(classes.toInput, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.absolute, staticPosition === true && this.state.focusedInput === 'from'), (0, _defineProperty2.default)(_classNames, classes.right4, staticPosition === true && this.state.focusedInput === 'from'), _classNames));
|
471
507
|
|
@@ -475,8 +511,8 @@ function (_React$Component) {
|
|
475
511
|
className: classes.fromInput,
|
476
512
|
onFocus: function onFocus() {
|
477
513
|
return _this2.handleDayPickerFocus('from');
|
478
|
-
}
|
479
|
-
|
514
|
+
},
|
515
|
+
onKeyDown: this.handleKeyDown('from')
|
480
516
|
}, _react.default.createElement("div", null, _react.default.createElement(_DayPickerInput.default, {
|
481
517
|
key: this.state.keyFrom,
|
482
518
|
ref: function ref(el) {
|
@@ -502,7 +538,8 @@ function (_React$Component) {
|
|
502
538
|
},
|
503
539
|
onBlur: function onBlur() {
|
504
540
|
return _this2.handleDayPickerBlur('to');
|
505
|
-
}
|
541
|
+
},
|
542
|
+
onKeyDown: this.handleKeyDown('to')
|
506
543
|
}, _react.default.createElement(_DayPickerInput.default, {
|
507
544
|
key: this.state.keyTo,
|
508
545
|
ref: function ref(el) {
|
@@ -516,8 +553,7 @@ function (_React$Component) {
|
|
516
553
|
inputProps: toInputProps,
|
517
554
|
format: enableTime ? "".concat(format, " HH:mm") : format,
|
518
555
|
formatDate: _moment.default.formatDate,
|
519
|
-
parseDate: _moment.default.parseDate
|
520
|
-
,
|
556
|
+
parseDate: _moment.default.parseDate,
|
521
557
|
placeholder: ''
|
522
558
|
})));
|
523
559
|
|
@@ -671,6 +707,11 @@ HiDateRangePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
671
707
|
*/
|
672
708
|
onReset: _propTypes.default.func,
|
673
709
|
|
710
|
+
/**
|
711
|
+
* Callback lorsque l'utilisateur tape sur "Entrée"
|
712
|
+
*/
|
713
|
+
onSubmit: _propTypes.default.func,
|
714
|
+
|
674
715
|
/**
|
675
716
|
* Si true, le calendrier sera dans une div static plutot que dans une popper absolute
|
676
717
|
*/
|
@@ -27,13 +27,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
27
27
|
|
28
28
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
29
29
|
|
30
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
31
|
-
|
32
30
|
var _react = _interopRequireDefault(require("react"));
|
33
31
|
|
34
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
35
33
|
|
36
|
-
var
|
34
|
+
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
37
35
|
|
38
36
|
var _reactDom = require("react-dom");
|
39
37
|
|
@@ -93,14 +91,14 @@ function yearAndQuarter(format, date, t) {
|
|
93
91
|
return indexY < indexM ? date.format("".concat(split[indexY]).concat(s, "[").concat(t.short_quarter, "]Q")) : date.format("[".concat(t.short_quarter, "]Q").concat(s).concat(split[indexY]));
|
94
92
|
}
|
95
93
|
|
96
|
-
function buildDateRangeOptionByKey(key, t, format) {
|
94
|
+
function buildDateRangeOptionByKey(key, t, format, timezoneName) {
|
97
95
|
var from;
|
98
96
|
var label;
|
99
97
|
var info;
|
100
98
|
var to;
|
101
99
|
var type;
|
102
100
|
|
103
|
-
|
101
|
+
_momentTimezone.default.updateLocale('en', {
|
104
102
|
week: {
|
105
103
|
dow: 1
|
106
104
|
}
|
@@ -109,71 +107,71 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
109
107
|
switch (key) {
|
110
108
|
case 'custom':
|
111
109
|
label = t.custom_period;
|
112
|
-
from = (0,
|
113
|
-
to = (0,
|
110
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(15, 'day').startOf('day');
|
111
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).endOf('day');
|
114
112
|
type = 'primary-highlight';
|
115
113
|
break;
|
116
114
|
|
117
115
|
case 'cd':
|
118
116
|
label = t.today;
|
119
|
-
from = (0,
|
120
|
-
to = (0,
|
117
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('day');
|
118
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).endOf('day');
|
121
119
|
info = "".concat(from.format(format));
|
122
120
|
break;
|
123
121
|
|
124
122
|
case 'pd':
|
125
123
|
label = t.yesterday;
|
126
|
-
from = (0,
|
127
|
-
to = (0,
|
124
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'day').startOf('day');
|
125
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'day').endOf('day');
|
128
126
|
info = "".concat(from.format(format));
|
129
127
|
break;
|
130
128
|
|
131
129
|
case 'cw':
|
132
130
|
label = t.current_week;
|
133
|
-
from = (0,
|
134
|
-
to = (0,
|
131
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('week');
|
132
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
135
133
|
info = "".concat(t.short_week).concat(from.format('w'), ", \n ").concat(from.format(format), " ").concat(t.to_now);
|
136
134
|
break;
|
137
135
|
|
138
136
|
case 'pw':
|
139
137
|
label = t.previous_week;
|
140
|
-
from = (0,
|
141
|
-
to = (0,
|
138
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'week').startOf('week');
|
139
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'week').endOf('week');
|
142
140
|
info = "".concat(t.short_week).concat(from.format('w'), ", ").concat(from.format(format), " ").concat(t.to, " ").concat(to.format(format));
|
143
141
|
break;
|
144
142
|
|
145
143
|
case 'cm':
|
146
144
|
label = t.current_month;
|
147
|
-
from = (0,
|
148
|
-
to = (0,
|
145
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('month');
|
146
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
149
147
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
150
148
|
break;
|
151
149
|
|
152
150
|
case 'pm':
|
153
151
|
label = t.previous_month;
|
154
|
-
from = (0,
|
155
|
-
to = (0,
|
152
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'month').startOf('month');
|
153
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'month').endOf('month');
|
156
154
|
info = "".concat(yearAndMonth(format, from), ", ").concat(from.daysInMonth(), " ").concat(t.days);
|
157
155
|
break;
|
158
156
|
|
159
157
|
case 'cq':
|
160
158
|
label = t.current_quarter;
|
161
|
-
from = (0,
|
162
|
-
to = (0,
|
159
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('quarter');
|
160
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
163
161
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
164
162
|
break;
|
165
163
|
|
166
164
|
case 'pq':
|
167
165
|
label = t.previous_quarter;
|
168
|
-
from = (0,
|
169
|
-
to = (0,
|
166
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'quarter').startOf('quarter');
|
167
|
+
to = (0, _momentTimezone.default)().tz(timezoneName).subtract(1, 'quarter').endOf('quarter');
|
170
168
|
info = "".concat(yearAndQuarter(format, from, t), ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
171
169
|
break;
|
172
170
|
|
173
171
|
case 'cy':
|
174
172
|
label = t.current_year;
|
175
|
-
from = (0,
|
176
|
-
to = (0,
|
173
|
+
from = (0, _momentTimezone.default)().tz(timezoneName).startOf('year');
|
174
|
+
to = (0, _momentTimezone.default)().tz(timezoneName);
|
177
175
|
info = "".concat(from.format(format), " ").concat(t.to_now, ", ").concat(to.diff(from, 'days') + 1, " ").concat(t.days);
|
178
176
|
break;
|
179
177
|
|
@@ -250,9 +248,9 @@ function (_React$Component) {
|
|
250
248
|
});
|
251
249
|
|
252
250
|
if (selectedOption) {
|
253
|
-
_this.props.onChange('from', selectedOption.from.
|
251
|
+
_this.props.onChange('from', new Date(selectedOption.from.format('YYYY-MM-DD HH:mm:ss')));
|
254
252
|
|
255
|
-
_this.props.onChange('to', selectedOption.to.
|
253
|
+
_this.props.onChange('to', new Date(selectedOption.to.format('YYYY-MM-DD HH:mm:ss')));
|
256
254
|
|
257
255
|
_this.props.onChange('fromError', false);
|
258
256
|
|
@@ -265,9 +263,8 @@ function (_React$Component) {
|
|
265
263
|
};
|
266
264
|
};
|
267
265
|
|
268
|
-
_this.handleSelectChange = _this.handleSelectChange.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
269
266
|
_this.options = props.availableOptionKeys.map(function (key) {
|
270
|
-
return buildDateRangeOptionByKey(key, props.translations, props.format);
|
267
|
+
return buildDateRangeOptionByKey(key, props.translations, props.format, props.timezoneName);
|
271
268
|
});
|
272
269
|
_this.state = {
|
273
270
|
selectedPreset: props.defaultPreset,
|
@@ -357,7 +354,8 @@ function (_React$Component) {
|
|
357
354
|
classes: {
|
358
355
|
root: classes.dateSelect
|
359
356
|
},
|
360
|
-
staticPosition: staticPosition
|
357
|
+
staticPosition: staticPosition,
|
358
|
+
onSubmit: this.props.onSubmit
|
361
359
|
}, selectProps))), _react.default.createElement(_Grid.default, {
|
362
360
|
item: true,
|
363
361
|
xs: 12,
|
@@ -411,6 +409,7 @@ HiDateRangeSelector.defaultProps = {
|
|
411
409
|
format: 'YYYY-DD-MM',
|
412
410
|
minimumDate: new Date(2013, 4, 1),
|
413
411
|
// by default 1 May 2013
|
412
|
+
timezoneName: 'Europe/Paris',
|
414
413
|
translations: {
|
415
414
|
today: 'Today',
|
416
415
|
hour: 'Hour',
|
@@ -529,6 +528,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
529
528
|
*/
|
530
529
|
onChange: _propTypes.default.func.isRequired,
|
531
530
|
|
531
|
+
/**
|
532
|
+
* Callback lorsque l'utilisateur tape sur "Entrée"
|
533
|
+
*/
|
534
|
+
onSubmit: _propTypes.default.func,
|
535
|
+
|
532
536
|
/**
|
533
537
|
* true si champs obligatoire
|
534
538
|
*/
|
@@ -549,6 +553,11 @@ HiDateRangeSelector.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
549
553
|
*/
|
550
554
|
staticPosition: _propTypes.default.bool,
|
551
555
|
|
556
|
+
/**
|
557
|
+
* Timezone de l'utilisateur
|
558
|
+
*/
|
559
|
+
timezoneName: _propTypes.default.string,
|
560
|
+
|
552
561
|
/**
|
553
562
|
* Date de fin sélectionnée
|
554
563
|
*/
|
@@ -43,8 +43,15 @@ function (_React$Component) {
|
|
43
43
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(YearPickerOverlay).call(this, props));
|
44
44
|
_this.years = [];
|
45
45
|
_this.handleYearClick = _this.handleYearClick.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
46
|
+
var minDate = props.minimumDate;
|
47
|
+
|
48
|
+
if (!minDate) {
|
49
|
+
var today = new Date();
|
50
|
+
minDate = new Date(today.getFullYear() - 5, today.getMonth(), today.getDate()); // by default 5 years from now
|
51
|
+
}
|
52
|
+
|
46
53
|
var currentYear = new Date().getFullYear();
|
47
|
-
var minimumYear =
|
54
|
+
var minimumYear = minDate.getFullYear();
|
48
55
|
_this.years = [currentYear]; // get years from minimum date to now
|
49
56
|
|
50
57
|
if (!props.disablePastDays && currentYear > minimumYear) {
|
@@ -95,8 +102,6 @@ function (_React$Component) {
|
|
95
102
|
}(_react.default.Component);
|
96
103
|
|
97
104
|
YearPickerOverlay.defaultProps = {
|
98
|
-
minimumDate: new Date(2013, 4, 1),
|
99
|
-
// by default 1 May 2013
|
100
105
|
translations: {
|
101
106
|
year: 'Year'
|
102
107
|
}
|