@hipay/hipay-material-ui 2.0.0-beta.74 → 2.0.0-beta.76
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +153 -0
- package/HiAlertModal/HiAlertModal.js +1 -1
- package/HiChip/HiChip.js +17 -1
- package/HiDatePicker/HiDatePicker.js +130 -125
- package/HiDatePicker/HiDatePickerMobile.js +127 -0
- package/HiDatePicker/HiDateRangePicker.js +53 -11
- package/HiDatePicker/HiDateRangeSelector.js +3 -1
- package/HiDatePicker/stylesheet.js +16 -0
- package/HiNotice/HiKPI.js +14 -8
- package/HiPaymentMeans/HiPaymentMeans.js +2 -1
- package/HiSelect/HiSelect.js +115 -37
- package/HiSelect/HiSelectInput.js +6 -1
- package/HiSelect/HiSelectMobile.js +198 -0
- package/es/HiAlertModal/HiAlertModal.js +1 -1
- package/es/HiChip/HiChip.js +17 -1
- package/es/HiDatePicker/HiDatePicker.js +149 -133
- package/es/HiDatePicker/HiDatePickerMobile.js +89 -0
- package/es/HiDatePicker/HiDateRangePicker.js +47 -9
- package/es/HiDatePicker/HiDateRangeSelector.js +2 -1
- package/es/HiDatePicker/stylesheet.js +16 -0
- package/es/HiNotice/HiKPI.js +13 -8
- package/es/HiPaymentMeans/HiPaymentMeans.js +2 -1
- package/es/HiSelect/HiSelect.js +110 -39
- package/es/HiSelect/HiSelectInput.js +6 -1
- package/es/HiSelect/HiSelectMobile.js +149 -0
- package/es/styles/createPalette.js +1 -1
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -1
- package/styles/createPalette.js +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,156 @@
|
|
1
|
+
# [2.0.0-beta.76](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.76) (2019-07-18)
|
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
|
+
* **HiAlertModal:** Correct styles and buttons positions ([2cfa2a9](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2cfa2a9))
|
8
|
+
* **HiAlertModal:** Title is not required anymore and will not create warning ([4019d33](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4019d33))
|
9
|
+
* **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
|
10
|
+
* **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
|
11
|
+
* **HiDynamicSelect:** remove onSelect override ([b803044](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b803044))
|
12
|
+
* **HiExpansionPanel:** fix props propagation collapseDisable || expanded ([eb18a96](https://gitlab.hipay.org/backend/hipay-material-ui/commit/eb18a96))
|
13
|
+
* **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
|
14
|
+
* **HiInput:** forward event in onClick ([be94fe0](https://gitlab.hipay.org/backend/hipay-material-ui/commit/be94fe0))
|
15
|
+
* **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
|
16
|
+
* **HiInput:** rename prop to spellCheck ([c11939f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c11939f))
|
17
|
+
* **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
|
18
|
+
* **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
|
19
|
+
* **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
|
20
|
+
* **HiSelect:** Forward event in onBlur ([76c6778](https://gitlab.hipay.org/backend/hipay-material-ui/commit/76c6778))
|
21
|
+
* **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
|
22
|
+
* **HiSelect:** remove HiSelectNew calls ([cc5397d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cc5397d))
|
23
|
+
* **HiSelectableList:** Add lazy props to activate lazyloading (default true) and fix unit tests ([b41f8d2](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b41f8d2))
|
24
|
+
* **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
|
25
|
+
* **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
|
26
|
+
* **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
|
27
|
+
* **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
|
28
|
+
* **HiTable:** Fix test ([9a009a8](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a009a8))
|
29
|
+
* **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
|
30
|
+
* **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
|
31
|
+
* **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
|
32
|
+
|
33
|
+
|
34
|
+
### Code Refactoring
|
35
|
+
|
36
|
+
* deleting the old HiSelect and replacing it by the new (PSYCHE-1382) ([d5fc252](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d5fc252))
|
37
|
+
|
38
|
+
|
39
|
+
### Features
|
40
|
+
|
41
|
+
* **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
|
42
|
+
* **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
|
43
|
+
* **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
|
44
|
+
* **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
|
45
|
+
* **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
|
46
|
+
* **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
|
47
|
+
* **HiDatePicke:** add timezone props ([18360a5](https://gitlab.hipay.org/backend/hipay-material-ui/commit/18360a5))
|
48
|
+
* **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
|
49
|
+
* **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
|
50
|
+
* **HiInput:** Add inputProps to enable passing props directly to input element ([d57466c](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d57466c))
|
51
|
+
* **HiInput:** add spellcheck property ([b2feac3](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b2feac3))
|
52
|
+
* **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
|
53
|
+
* **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
|
54
|
+
* **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
|
55
|
+
* **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
|
56
|
+
* **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
|
57
|
+
* **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
|
58
|
+
* **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
|
59
|
+
* **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
|
60
|
+
|
61
|
+
|
62
|
+
### Performance Improvements
|
63
|
+
|
64
|
+
* **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
|
65
|
+
|
66
|
+
|
67
|
+
### BREAKING CHANGES
|
68
|
+
|
69
|
+
* HiSelectNew no longer exist, make sure you're importing HiSelect instead
|
70
|
+
* **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
|
71
|
+
* **HiUploadField:** Components names changes
|
72
|
+
* **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
|
73
|
+
CellImage & CellText)
|
74
|
+
* **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# [2.0.0-beta.74](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.74) (2019-07-02)
|
79
|
+
|
80
|
+
|
81
|
+
### Bug Fixes
|
82
|
+
|
83
|
+
* **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
|
84
|
+
* **HiAlertModal:** Correct styles and buttons positions ([2cfa2a9](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2cfa2a9))
|
85
|
+
* **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
|
86
|
+
* **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
|
87
|
+
* **HiDynamicSelect:** remove onSelect override ([b803044](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b803044))
|
88
|
+
* **HiExpansionPanel:** fix props propagation collapseDisable || expanded ([eb18a96](https://gitlab.hipay.org/backend/hipay-material-ui/commit/eb18a96))
|
89
|
+
* **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
|
90
|
+
* **HiInput:** forward event in onClick ([be94fe0](https://gitlab.hipay.org/backend/hipay-material-ui/commit/be94fe0))
|
91
|
+
* **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
|
92
|
+
* **HiInput:** rename prop to spellCheck ([c11939f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c11939f))
|
93
|
+
* **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
|
94
|
+
* **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
|
95
|
+
* **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
|
96
|
+
* **HiSelect:** Forward event in onBlur ([76c6778](https://gitlab.hipay.org/backend/hipay-material-ui/commit/76c6778))
|
97
|
+
* **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
|
98
|
+
* **HiSelect:** remove HiSelectNew calls ([cc5397d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cc5397d))
|
99
|
+
* **HiSelectableList:** Add lazy props to activate lazyloading (default true) and fix unit tests ([b41f8d2](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b41f8d2))
|
100
|
+
* **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
|
101
|
+
* **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
|
102
|
+
* **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
|
103
|
+
* **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
|
104
|
+
* **HiTable:** Fix test ([9a009a8](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a009a8))
|
105
|
+
* **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
|
106
|
+
* **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
|
107
|
+
* **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
|
108
|
+
|
109
|
+
|
110
|
+
### Code Refactoring
|
111
|
+
|
112
|
+
* deleting the old HiSelect and replacing it by the new (PSYCHE-1382) ([d5fc252](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d5fc252))
|
113
|
+
|
114
|
+
|
115
|
+
### Features
|
116
|
+
|
117
|
+
* **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
|
118
|
+
* **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
|
119
|
+
* **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
|
120
|
+
* **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
|
121
|
+
* **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
|
122
|
+
* **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
|
123
|
+
* **HiDatePicke:** add timezone props ([18360a5](https://gitlab.hipay.org/backend/hipay-material-ui/commit/18360a5))
|
124
|
+
* **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
|
125
|
+
* **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
|
126
|
+
* **HiInput:** Add inputProps to enable passing props directly to input element ([d57466c](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d57466c))
|
127
|
+
* **HiInput:** add spellcheck property ([b2feac3](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b2feac3))
|
128
|
+
* **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
|
129
|
+
* **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
|
130
|
+
* **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
|
131
|
+
* **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
|
132
|
+
* **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
|
133
|
+
* **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
|
134
|
+
* **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
|
135
|
+
* **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
|
136
|
+
|
137
|
+
|
138
|
+
### Performance Improvements
|
139
|
+
|
140
|
+
* **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
|
141
|
+
|
142
|
+
|
143
|
+
### BREAKING CHANGES
|
144
|
+
|
145
|
+
* HiSelectNew no longer exist, make sure you're importing HiSelect instead
|
146
|
+
* **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
|
147
|
+
* **HiUploadField:** Components names changes
|
148
|
+
* **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
|
149
|
+
CellImage & CellText)
|
150
|
+
* **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
|
151
|
+
|
152
|
+
|
153
|
+
|
1
154
|
# [2.0.0-beta.74](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.74) (2019-06-06)
|
2
155
|
|
3
156
|
|
@@ -161,7 +161,7 @@ function (_React$PureComponent) {
|
|
161
161
|
color: theme.palette.background2,
|
162
162
|
icon: backgroundIcon,
|
163
163
|
size: iconSize
|
164
|
-
})), _react.default.createElement(_DialogTitle.default, {
|
164
|
+
})), title && _react.default.createElement(_DialogTitle.default, {
|
165
165
|
disableTypography: true,
|
166
166
|
classes: {
|
167
167
|
root: classes.classTitle
|
package/HiChip/HiChip.js
CHANGED
@@ -130,6 +130,8 @@ function HiChip(props) {
|
|
130
130
|
id = props.id,
|
131
131
|
img = props.img,
|
132
132
|
label = props.label,
|
133
|
+
onClick = props.onClick,
|
134
|
+
onKeyDown = props.onKeyDown,
|
133
135
|
onPrevious = props.onPrevious,
|
134
136
|
onNext = props.onNext,
|
135
137
|
onDelete = props.onDelete,
|
@@ -143,8 +145,12 @@ function HiChip(props) {
|
|
143
145
|
titlePrevious = props.titlePrevious;
|
144
146
|
return _react.default.createElement("div", {
|
145
147
|
id: id,
|
148
|
+
role: 'button',
|
146
149
|
className: (0, _classnames.default)(classes.root, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.leftNavigation, onPrevious), (0, _defineProperty2.default)(_classNames, classes.rightNavigation, onNext), (0, _defineProperty2.default)(_classNames, classes.deletable, onDelete), (0, _defineProperty2.default)(_classNames, classes.leftIcon, icon), _classNames)),
|
147
|
-
title: title
|
150
|
+
title: title,
|
151
|
+
onClick: onClick,
|
152
|
+
onKeyDown: onKeyDown,
|
153
|
+
tabIndex: "0"
|
148
154
|
}, icon && _react.default.createElement(_HiIcon.default, {
|
149
155
|
className: (0, _classnames.default)(classes.icon, (0, _defineProperty2.default)({}, classes.iconClickable, onIconClick)),
|
150
156
|
icon: icon,
|
@@ -247,6 +253,11 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
247
253
|
*/
|
248
254
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
249
255
|
|
256
|
+
/**
|
257
|
+
* Fonction de callback au clic sur la chip
|
258
|
+
*/
|
259
|
+
onClick: _propTypes.default.func,
|
260
|
+
|
250
261
|
/**
|
251
262
|
* Fonction de callback au clic sur l'icon close si cancelable = true
|
252
263
|
*/
|
@@ -257,6 +268,11 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
257
268
|
*/
|
258
269
|
onIconClick: _propTypes.default.func,
|
259
270
|
|
271
|
+
/**
|
272
|
+
* Fonction de callback à l'appui sur une touche du clavier
|
273
|
+
*/
|
274
|
+
onKeyDown: _propTypes.default.func,
|
275
|
+
|
260
276
|
/**
|
261
277
|
* Fonction de callback au clic sur l'icon next
|
262
278
|
*/
|
@@ -23,8 +23,6 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
23
23
|
|
24
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
25
25
|
|
26
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
27
|
-
|
28
26
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
29
27
|
|
30
28
|
var _react = _interopRequireDefault(require("react"));
|
@@ -59,6 +57,14 @@ var _HiTextField = _interopRequireDefault(require("../HiForm/HiTextField"));
|
|
59
57
|
|
60
58
|
var _stylesheet = _interopRequireDefault(require("./stylesheet"));
|
61
59
|
|
60
|
+
var _reactDeviceDetect = require("react-device-detect");
|
61
|
+
|
62
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
63
|
+
|
64
|
+
var _HiFormControl = _interopRequireDefault(require("../HiForm/HiFormControl"));
|
65
|
+
|
66
|
+
var _HiDatePickerMobile = _interopRequireDefault(require("./HiDatePickerMobile"));
|
67
|
+
|
62
68
|
var HiDatePicker =
|
63
69
|
/*#__PURE__*/
|
64
70
|
function (_React$Component) {
|
@@ -70,6 +76,10 @@ function (_React$Component) {
|
|
70
76
|
(0, _classCallCheck2.default)(this, HiDatePicker);
|
71
77
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiDatePicker).call(this));
|
72
78
|
|
79
|
+
_this.handleInputChange = function (event) {
|
80
|
+
_this.props.onChange(event.target.value);
|
81
|
+
};
|
82
|
+
|
73
83
|
_this.handleKeyDown = function (name) {
|
74
84
|
return function (event) {
|
75
85
|
if (event.key === 'Escape' && !event.shiftKey) {
|
@@ -80,182 +90,160 @@ function (_React$Component) {
|
|
80
90
|
};
|
81
91
|
};
|
82
92
|
|
83
|
-
|
84
|
-
|
85
|
-
openedPanel: 'calendar',
|
86
|
-
currentMonth: props.value ? props.value : new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds())
|
87
|
-
}; // this.formatDate = this.formatDate.bind(this);
|
88
|
-
|
89
|
-
_this.handleCalendarClick = _this.handleCalendarClick.bind((0, _assertThisInitialized2.default)(_this));
|
90
|
-
_this.handleClockClick = _this.handleClockClick.bind((0, _assertThisInitialized2.default)(_this));
|
91
|
-
_this.handleMonthClick = _this.handleMonthClick.bind((0, _assertThisInitialized2.default)(_this));
|
92
|
-
_this.handleYearClick = _this.handleYearClick.bind((0, _assertThisInitialized2.default)(_this));
|
93
|
-
_this.handleDayChange = _this.handleDayChange.bind((0, _assertThisInitialized2.default)(_this));
|
94
|
-
_this.handleCurrentMonthChange = _this.handleCurrentMonthChange.bind((0, _assertThisInitialized2.default)(_this));
|
95
|
-
_this.handleReset = _this.handleReset.bind((0, _assertThisInitialized2.default)(_this));
|
96
|
-
_this.handleTimeChange = _this.handleTimeChange.bind((0, _assertThisInitialized2.default)(_this));
|
97
|
-
_this.openPanel = _this.openPanel.bind((0, _assertThisInitialized2.default)(_this));
|
98
|
-
_this.renderCaption = _this.renderCaption.bind((0, _assertThisInitialized2.default)(_this));
|
99
|
-
_this.renderOverlay = _this.renderOverlay.bind((0, _assertThisInitialized2.default)(_this));
|
100
|
-
_this.renderMonthPickerOverlay = _this.renderMonthPickerOverlay.bind((0, _assertThisInitialized2.default)(_this));
|
101
|
-
_this.renderTimePickerOverlay = _this.renderTimePickerOverlay.bind((0, _assertThisInitialized2.default)(_this));
|
102
|
-
_this.renderYearPickerOverlay = _this.renderYearPickerOverlay.bind((0, _assertThisInitialized2.default)(_this));
|
103
|
-
_this.handleInputChange = _this.handleInputChange.bind((0, _assertThisInitialized2.default)(_this));
|
104
|
-
return _this;
|
105
|
-
}
|
93
|
+
_this.handleReset = function () {
|
94
|
+
var today = (0, _momentTimezone.default)().tz(_this.props.timezoneName);
|
106
95
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
key: "handleInputChange",
|
114
|
-
value: function handleInputChange(event) {
|
115
|
-
this.props.onChange(event.target.value);
|
116
|
-
}
|
117
|
-
}, {
|
118
|
-
key: "handleReset",
|
119
|
-
value: function handleReset() {
|
120
|
-
var today = (0, _momentTimezone.default)().tz(this.props.timezoneName);
|
121
|
-
this.handleCurrentMonthChange(new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds()));
|
122
|
-
this.props.onReset();
|
123
|
-
}
|
124
|
-
}, {
|
125
|
-
key: "handleDayChange",
|
126
|
-
value: function handleDayChange(day, modifiers) {
|
96
|
+
_this.handleCurrentMonthChange(new Date(today.year(), today.month(), today.date(), today.hours(), today.minutes(), today.seconds(), today.milliseconds()));
|
97
|
+
|
98
|
+
_this.props.onReset();
|
99
|
+
};
|
100
|
+
|
101
|
+
_this.handleDayChange = function (day, modifiers) {
|
127
102
|
if (day) {
|
128
103
|
if (modifiers.selected) {
|
129
104
|
// Deselect day
|
130
|
-
|
105
|
+
_this.props.onChange(undefined);
|
131
106
|
} else {
|
132
107
|
// Keep Time if set
|
133
|
-
if (
|
134
|
-
if (
|
135
|
-
day.setHours(
|
108
|
+
if (_this.props.enableTime && day !== undefined) {
|
109
|
+
if (_this.props.value) {
|
110
|
+
day.setHours(_this.props.value.getHours(), _this.props.value.getMinutes());
|
136
111
|
} else {
|
137
112
|
day.setHours(0, 0);
|
138
113
|
}
|
139
114
|
}
|
140
115
|
|
141
|
-
|
116
|
+
_this.props.onChange(day);
|
142
117
|
}
|
143
118
|
|
144
|
-
if (day instanceof Date && !
|
119
|
+
if (day instanceof Date && !_this.props.enableTime && modifiers.selected !== true) {
|
145
120
|
// Hide overlay & remove focus on input
|
146
121
|
document.activeElement.blur();
|
147
|
-
} else if (day instanceof Date &&
|
122
|
+
} else if (day instanceof Date && _this.props.enableTime && modifiers.selected !== true) {
|
148
123
|
// Open Time panel after date selection
|
149
|
-
|
124
|
+
_this.openPanel('time');
|
150
125
|
}
|
151
126
|
}
|
152
|
-
}
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
127
|
+
};
|
128
|
+
|
129
|
+
_this.handleChangeMobile = function (event) {
|
130
|
+
var date;
|
131
|
+
|
132
|
+
if (event.target.value) {
|
133
|
+
date = new Date(event.target.value);
|
134
|
+
}
|
135
|
+
|
136
|
+
_this.props.onChange(date);
|
137
|
+
};
|
138
|
+
|
139
|
+
_this.handleCalendarClick = function () {
|
140
|
+
_this.openPanel('calendar');
|
141
|
+
};
|
142
|
+
|
143
|
+
_this.handleClockClick = function () {
|
144
|
+
_this.openPanel('time');
|
145
|
+
};
|
146
|
+
|
147
|
+
_this.handleMonthClick = function () {
|
148
|
+
_this.openPanel('months');
|
149
|
+
};
|
150
|
+
|
151
|
+
_this.handleYearClick = function () {
|
152
|
+
_this.openPanel('years');
|
153
|
+
};
|
154
|
+
|
155
|
+
_this.handleCurrentMonthChange = function (day) {
|
156
|
+
_this.setState({
|
177
157
|
// Current Month can't be anterior to minimumDate
|
178
|
-
currentMonth: day <
|
158
|
+
currentMonth: day < _this.props.minimumDate ? _this.props.minimumDate : day,
|
179
159
|
openedPanel: 'calendar'
|
180
160
|
});
|
181
|
-
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
this.props.onChange(date);
|
161
|
+
};
|
162
|
+
|
163
|
+
_this.handleTimeChange = function (date, precision) {
|
164
|
+
_this.props.onChange(date);
|
186
165
|
|
187
166
|
if (date instanceof Date && precision === 'minute') {
|
188
167
|
document.activeElement.blur();
|
189
168
|
}
|
190
|
-
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
this.setState({
|
169
|
+
};
|
170
|
+
|
171
|
+
_this.openPanel = function (panel) {
|
172
|
+
_this.setState({
|
195
173
|
openedPanel: panel
|
196
174
|
});
|
197
|
-
}
|
198
|
-
|
199
|
-
|
200
|
-
value: function renderCaption(propsCaption) {
|
175
|
+
};
|
176
|
+
|
177
|
+
_this.renderCaption = function (propsCaption) {
|
201
178
|
return _react.default.createElement(_Caption.default, (0, _extends2.default)({
|
202
|
-
onMonthClick:
|
203
|
-
onYearClick:
|
179
|
+
onMonthClick: _this.handleMonthClick,
|
180
|
+
onYearClick: _this.handleYearClick
|
204
181
|
}, propsCaption));
|
205
|
-
}
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
switch (this.state.openedPanel) {
|
182
|
+
};
|
183
|
+
|
184
|
+
_this.renderOverlay = function (propsOverlay) {
|
185
|
+
switch (_this.state.openedPanel) {
|
210
186
|
case 'time':
|
211
|
-
return
|
187
|
+
return _this.renderTimePickerOverlay(propsOverlay);
|
212
188
|
|
213
189
|
case 'months':
|
214
|
-
return
|
190
|
+
return _this.renderMonthPickerOverlay(propsOverlay);
|
215
191
|
|
216
192
|
case 'years':
|
217
|
-
return
|
193
|
+
return _this.renderYearPickerOverlay(propsOverlay);
|
218
194
|
|
219
195
|
case 'calendar':
|
220
196
|
default:
|
221
197
|
return _react.default.createElement(_Overlay.default, propsOverlay);
|
222
198
|
}
|
223
|
-
}
|
224
|
-
|
225
|
-
|
226
|
-
value: function renderMonthPickerOverlay(propsOverlay) {
|
199
|
+
};
|
200
|
+
|
201
|
+
_this.renderMonthPickerOverlay = function (propsOverlay) {
|
227
202
|
var monthPickerProps = {
|
228
|
-
value:
|
229
|
-
onChange:
|
203
|
+
value: _this.state.currentMonth,
|
204
|
+
onChange: _this.handleCurrentMonthChange
|
230
205
|
};
|
231
206
|
return _react.default.createElement(_MonthPickerOverlay.default, (0, _extends2.default)({
|
232
207
|
key: 'month-picker-overlay'
|
233
208
|
}, monthPickerProps, propsOverlay));
|
234
|
-
}
|
235
|
-
|
236
|
-
|
237
|
-
value: function renderTimePickerOverlay(propsOverlay) {
|
209
|
+
};
|
210
|
+
|
211
|
+
_this.renderTimePickerOverlay = function (propsOverlay) {
|
238
212
|
var timePickerProps = {
|
239
|
-
value:
|
240
|
-
onChange:
|
241
|
-
onCalendarClick:
|
213
|
+
value: _this.props.value,
|
214
|
+
onChange: _this.handleTimeChange,
|
215
|
+
onCalendarClick: _this.handleCalendarClick
|
242
216
|
};
|
243
217
|
return _react.default.createElement(_TimePickerOverlay.default, (0, _extends2.default)({
|
244
218
|
key: 'time-picker-overlay'
|
245
219
|
}, timePickerProps, propsOverlay));
|
246
|
-
}
|
247
|
-
|
248
|
-
|
249
|
-
value: function renderYearPickerOverlay(propsOverlay) {
|
220
|
+
};
|
221
|
+
|
222
|
+
_this.renderYearPickerOverlay = function (propsOverlay) {
|
250
223
|
var yearPickerProps = {
|
251
|
-
value:
|
252
|
-
onChange:
|
253
|
-
disableFutureDays:
|
254
|
-
minimumDate:
|
224
|
+
value: _this.state.currentMonth,
|
225
|
+
onChange: _this.handleCurrentMonthChange,
|
226
|
+
disableFutureDays: _this.props.disableFutureDays,
|
227
|
+
minimumDate: _this.props.minimumDate
|
255
228
|
};
|
256
229
|
return _react.default.createElement(_YearPickerOverlay.default, (0, _extends2.default)({
|
257
230
|
key: 'year-picker-overlay'
|
258
231
|
}, yearPickerProps, propsOverlay));
|
232
|
+
};
|
233
|
+
|
234
|
+
var _today = (0, _momentTimezone.default)().tz(props.timezoneName);
|
235
|
+
|
236
|
+
_this.state = {
|
237
|
+
openedPanel: 'calendar',
|
238
|
+
currentMonth: props.value ? props.value : new Date(_today.year(), _today.month(), _today.date(), _today.hours(), _today.minutes(), _today.seconds(), _today.milliseconds())
|
239
|
+
};
|
240
|
+
return _this;
|
241
|
+
}
|
242
|
+
|
243
|
+
(0, _createClass2.default)(HiDatePicker, [{
|
244
|
+
key: "componentWillUnmount",
|
245
|
+
value: function componentWillUnmount() {
|
246
|
+
clearTimeout(this.timeout);
|
259
247
|
}
|
260
248
|
}, {
|
261
249
|
key: "render",
|
@@ -327,7 +315,7 @@ function (_React$Component) {
|
|
327
315
|
return _react.default.createElement("div", {
|
328
316
|
className: classes.root,
|
329
317
|
onKeyDown: this.handleKeyDown()
|
330
|
-
}, _react.default.createElement(_DayPickerInput.default, {
|
318
|
+
}, !_reactDeviceDetect.isMobile ? _react.default.createElement(_DayPickerInput.default, {
|
331
319
|
ref: function ref(el) {
|
332
320
|
_this2.datePickerInput = el;
|
333
321
|
},
|
@@ -342,6 +330,23 @@ function (_React$Component) {
|
|
342
330
|
formatDate: _moment.default.formatDate,
|
343
331
|
parseDate: _moment.default.parseDate,
|
344
332
|
onDayChange: this.handleDayChange
|
333
|
+
}) : _react.default.createElement(_HiDatePickerMobile.default, {
|
334
|
+
id: this.props.id,
|
335
|
+
label: this.props.label,
|
336
|
+
required: this.props.required,
|
337
|
+
disabled: this.props.disabled,
|
338
|
+
error: this.props.error,
|
339
|
+
errorText: this.props.errorText,
|
340
|
+
helperText: this.props.helperText,
|
341
|
+
helperIcon: this.props.helperIcon,
|
342
|
+
enableTime: enableTime,
|
343
|
+
value: value,
|
344
|
+
onChange: this.handleChangeMobile,
|
345
|
+
disablePastDays: disablePastDays,
|
346
|
+
disableFutureDays: disableFutureDays,
|
347
|
+
today: today,
|
348
|
+
minimumDate: minimumDate,
|
349
|
+
format: enableTime ? "".concat(format, " HH:mm") : format
|
345
350
|
}));
|
346
351
|
}
|
347
352
|
}]);
|