@hipay/hipay-material-ui 2.0.0-beta.55 → 2.0.0-beta.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -0
- package/HiBreadcrumb/HiBreadcrumb.js +14 -4
- package/HiBreadcrumb/HiStep.js +4 -1
- package/HiBreadcrumb/HiStepContent.js +0 -1
- package/HiBreadcrumb/HiStepLabel.js +12 -4
- package/HiBreadcrumb/HiStepper.js +1 -1
- package/HiButton/HiButton.js +7 -1
- package/HiCell/CellIcon.js +4 -4
- package/HiCell/CellImage.js +13 -1
- package/HiCell/CellRate.js +6 -3
- package/HiCell/CellSentinel.js +7 -10
- package/HiCell/CellTextStyled.js +29 -1
- package/HiColoredLabel/HiColoredLabel.js +1 -1
- package/HiDatePicker/Caption.js +16 -10
- package/HiDatePicker/HiDatePicker.js +9 -3
- package/HiDatePicker/HiDateRangePicker.js +36 -22
- package/HiDatePicker/HiDateRangeSelector.js +75 -21
- package/HiDatePicker/NavBar.js +8 -1
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
- package/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +123 -0
- package/HiDatePicker/Overlays/MonthPickerOverlay.js +4 -4
- package/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
- package/HiDatePicker/Overlays/Overlay.js +15 -8
- package/HiDatePicker/Overlays/Overlay.spec.js +1 -0
- package/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
- package/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
- package/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
- package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/HiDatePicker/hiLocaleUtils.js +144 -0
- package/HiDatePicker/stylesheet.js +33 -7
- package/HiDotsStepper/HiDot.js +108 -0
- package/HiDotsStepper/HiDotsStepper.js +121 -0
- package/HiExpansionPanel/HiExpansionPanel.js +1 -1
- package/HiForm/HiAddressField.js +176 -0
- package/HiForm/HiFormControl.js +2 -0
- package/HiForm/HiInput.js +3 -3
- package/HiForm/HiSlider.js +352 -0
- package/HiForm/HiUpload.js +204 -0
- package/HiForm/HiUploadField.js +182 -0
- package/HiForm/HiUploadInput.js +459 -0
- package/HiForm/index.js +16 -0
- package/HiMap/HiMap.js +345 -0
- package/HiMap/HiMapExpand.js +210 -0
- package/HiMap/index.js +23 -0
- package/HiNotice/HiKPI.js +238 -0
- package/HiNotice/HiKPINotice.js +96 -0
- package/HiNotice/index.js +23 -0
- package/HiPdfReader/HiPdfReader.js +269 -0
- package/HiPdfReader/index.js +15 -0
- package/HiPin/HiPin.js +1 -1
- package/HiRadio/HiRadio.js +74 -0
- package/HiRadio/index.js +15 -0
- package/HiSelect/HiSelect.js +73 -84
- package/HiSelect/HiSuggestSelect.js +35 -4
- package/HiSelect/SelectInput.js +9 -1
- package/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/HiSelectNew/HiSelect.js +260 -179
- package/HiSelectNew/HiSelectContent.js +0 -8
- package/HiSelectNew/HiSelectInput.js +8 -9
- package/HiSelectableList/HiSelectableList.js +39 -4
- package/HiSelectableList/HiSelectableListItem.js +81 -38
- package/HiTable/HiCellBuilder.js +25 -12
- package/HiTable/HiTableHeader.js +16 -17
- package/HiTable/constants.js +3 -1
- package/README.md +248 -98
- package/es/HiBreadcrumb/HiBreadcrumb.js +14 -4
- package/es/HiBreadcrumb/HiStep.js +4 -1
- package/es/HiBreadcrumb/HiStepContent.js +0 -1
- package/es/HiBreadcrumb/HiStepLabel.js +13 -4
- package/es/HiBreadcrumb/HiStepper.js +1 -1
- package/es/HiButton/HiButton.js +7 -0
- package/es/HiCell/CellIcon.js +5 -5
- package/es/HiCell/CellImage.js +13 -1
- package/es/HiCell/CellRate.js +6 -3
- package/es/HiCell/CellSentinel.js +7 -10
- package/es/HiCell/CellTextStyled.js +28 -1
- package/es/HiColoredLabel/HiColoredLabel.js +1 -1
- package/es/HiDatePicker/Caption.js +14 -10
- package/es/HiDatePicker/HiDatePicker.js +8 -3
- package/es/HiDatePicker/HiDateRangePicker.js +40 -28
- package/es/HiDatePicker/HiDateRangeSelector.js +69 -21
- package/es/HiDatePicker/ListPicker.js +1 -1
- package/es/HiDatePicker/NavBar.js +7 -1
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
- package/es/HiDatePicker/Overlays/CustomOverlayLayoutWithoutFooter.js +106 -0
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +5 -5
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/Overlay.js +16 -9
- package/es/HiDatePicker/Overlays/Overlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/TimePickerOverlay.js +2 -2
- package/es/HiDatePicker/Overlays/TimePickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/Overlays/YearPickerOverlay.js +4 -6
- package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/hiLocaleUtils.js +131 -0
- package/es/HiDatePicker/stylesheet.js +32 -7
- package/es/HiDotsStepper/HiDot.js +66 -0
- package/es/HiDotsStepper/HiDotsStepper.js +73 -0
- package/es/HiExpansionPanel/HiExpansionPanel.js +1 -1
- package/es/HiForm/HiAddressField.js +134 -0
- package/es/HiForm/HiFormControl.js +2 -0
- package/es/HiForm/HiInput.js +3 -3
- package/es/HiForm/HiSlider.js +302 -0
- package/es/HiForm/HiUpload.js +158 -0
- package/es/HiForm/HiUploadField.js +140 -0
- package/es/HiForm/HiUploadInput.js +411 -0
- package/es/HiForm/index.js +2 -0
- package/es/HiMap/HiMap.js +290 -0
- package/es/HiMap/HiMapExpand.js +162 -0
- package/es/HiMap/index.js +2 -0
- package/es/HiNotice/HiKPI.js +196 -0
- package/es/HiNotice/HiKPINotice.js +78 -0
- package/es/HiNotice/index.js +2 -0
- package/es/HiPdfReader/HiPdfReader.js +214 -0
- package/es/HiPdfReader/index.js +1 -0
- package/es/HiPin/HiPin.js +1 -1
- package/es/HiRadio/HiRadio.js +55 -0
- package/es/HiRadio/index.js +1 -0
- package/es/HiSelect/HiSelect.js +68 -78
- package/es/HiSelect/HiSuggestSelect.js +30 -4
- package/es/HiSelect/SelectInput.js +9 -1
- package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/es/HiSelectNew/HiSelect.js +246 -162
- package/es/HiSelectNew/HiSelectContent.js +0 -7
- package/es/HiSelectNew/HiSelectInput.js +8 -9
- package/es/HiSelectableList/HiSelectableList.js +34 -6
- package/es/HiSelectableList/HiSelectableListItem.js +92 -40
- package/es/HiTable/HiCellBuilder.js +130 -123
- package/es/HiTable/HiTableHeader.js +14 -12
- package/es/HiTable/constants.js +1 -0
- package/es/index.js +9 -1
- package/es/utils/helpers.js +1 -1
- package/index.es.js +9 -1
- package/index.js +66 -2
- package/package.json +5 -2
- package/umd/hipay-material-ui.development.js +44450 -40930
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
+
import HiKPI from './HiKPI';
|
|
5
|
+
|
|
6
|
+
const styles = () => ({
|
|
7
|
+
container: {
|
|
8
|
+
minWidth: 230,
|
|
9
|
+
width: '100%',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexWrap: 'wrap',
|
|
12
|
+
justifyContent: 'center'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const HiKPINotice = ({
|
|
17
|
+
classes,
|
|
18
|
+
kpis,
|
|
19
|
+
activeKpi,
|
|
20
|
+
minify,
|
|
21
|
+
onClickOnKPI
|
|
22
|
+
}) => {
|
|
23
|
+
return React.createElement("div", {
|
|
24
|
+
className: classes.container
|
|
25
|
+
}, Object.keys(kpis).map(key => {
|
|
26
|
+
const kpi = kpis[key];
|
|
27
|
+
return React.createElement(HiKPI, {
|
|
28
|
+
key: key,
|
|
29
|
+
id: key,
|
|
30
|
+
type: kpi.type,
|
|
31
|
+
color: kpi.color,
|
|
32
|
+
title: kpi.title,
|
|
33
|
+
body: kpi.body,
|
|
34
|
+
bodyMinify: kpi.bodyMinify,
|
|
35
|
+
subtitle: kpi.subtitle,
|
|
36
|
+
tooltip: kpi.tooltip,
|
|
37
|
+
onClick: () => onClickOnKPI(key),
|
|
38
|
+
active: activeKpi === key,
|
|
39
|
+
minify: minify,
|
|
40
|
+
disable: kpi.disable
|
|
41
|
+
});
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
HiKPINotice.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
46
|
+
/**
|
|
47
|
+
* Extension du style appliqué au composant
|
|
48
|
+
*/
|
|
49
|
+
activeKpi: PropTypes.string,
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Liste des KPIs
|
|
53
|
+
*/
|
|
54
|
+
classes: PropTypes.object,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Fonction appelée au clic sur un KPI
|
|
58
|
+
*/
|
|
59
|
+
kpis: PropTypes.object.isRequired,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Liste des KPIS actifs
|
|
63
|
+
*/
|
|
64
|
+
minify: PropTypes.bool,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Minifie les KPIs si vrai
|
|
68
|
+
*/
|
|
69
|
+
onClickOnKPI: PropTypes.func
|
|
70
|
+
} : {};
|
|
71
|
+
HiKPINotice.defaultProps = {
|
|
72
|
+
activeKpi: null,
|
|
73
|
+
minify: false
|
|
74
|
+
};
|
|
75
|
+
export default withStyles(styles, {
|
|
76
|
+
hiComponent: true,
|
|
77
|
+
name: 'HmuiHiKPINotice'
|
|
78
|
+
})(HiKPINotice);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import HiButton from '../HiButton';
|
|
6
|
+
import HiIcon from '../HiIcon'; // import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
|
|
7
|
+
// import ChevronRightIcon from '@material-ui/icons/ChevronRight/';
|
|
8
|
+
|
|
9
|
+
import CircularProgress from '@material-ui/core/CircularProgress/';
|
|
10
|
+
import { withStyles } from '../styles';
|
|
11
|
+
export const styles = theme => ({
|
|
12
|
+
root: {
|
|
13
|
+
position: 'relative'
|
|
14
|
+
},
|
|
15
|
+
pageNumber: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
bottom: 16,
|
|
18
|
+
left: -24,
|
|
19
|
+
backgroundColor: '#FFFFFF',
|
|
20
|
+
borderRadius: 4,
|
|
21
|
+
paddingTop: 7,
|
|
22
|
+
paddingBottom: 7,
|
|
23
|
+
paddingRight: 8,
|
|
24
|
+
paddingLeft: 8,
|
|
25
|
+
fontSize: 15,
|
|
26
|
+
fontFamily: theme.typography.fontFamily,
|
|
27
|
+
boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
|
|
28
|
+
color: '#737373'
|
|
29
|
+
},
|
|
30
|
+
pagesNavigation: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
top: 16,
|
|
33
|
+
right: -30,
|
|
34
|
+
backgroundColor: '#FFFFFF',
|
|
35
|
+
borderRadius: 3,
|
|
36
|
+
paddingTop: 4,
|
|
37
|
+
paddingBottom: 4,
|
|
38
|
+
paddingRight: 3,
|
|
39
|
+
paddingLeft: 3,
|
|
40
|
+
fontFamily: theme.typography.fontFamily,
|
|
41
|
+
boxShadow: '1px 1px 5px rgba(0, 0, 0, .16)',
|
|
42
|
+
color: '#737373',
|
|
43
|
+
'&>button:first-child': {
|
|
44
|
+
marginRight: 6
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
navigationButton: {
|
|
48
|
+
padding: 0,
|
|
49
|
+
minWidth: 0,
|
|
50
|
+
minHeight: 0
|
|
51
|
+
}
|
|
52
|
+
}); // Constantes utilisées pour le redimentionnement du PDF (format mobile par exemple)
|
|
53
|
+
|
|
54
|
+
const maxWindowWidth = 900;
|
|
55
|
+
const maxPdfWidth = 600;
|
|
56
|
+
let Document;
|
|
57
|
+
let Page;
|
|
58
|
+
|
|
59
|
+
var _ref = React.createElement(CircularProgress, null);
|
|
60
|
+
|
|
61
|
+
var _ref2 = React.createElement(HiIcon, {
|
|
62
|
+
icon: "chevron_left"
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
var _ref3 = React.createElement(HiIcon, {
|
|
66
|
+
icon: "chevron_right"
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
class HiPdfReader extends React.PureComponent {
|
|
70
|
+
constructor(...args) {
|
|
71
|
+
super(...args);
|
|
72
|
+
this.state = {
|
|
73
|
+
numPages: null,
|
|
74
|
+
pageNumber: 1,
|
|
75
|
+
error: false,
|
|
76
|
+
width: 600
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.handleLoadSuccess = ({
|
|
80
|
+
numPages
|
|
81
|
+
}) => {
|
|
82
|
+
this.setState({
|
|
83
|
+
numPages,
|
|
84
|
+
error: false
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
this.handleLoadError = () => {
|
|
89
|
+
this.setState({
|
|
90
|
+
error: true
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
this.handleClickNextPage = () => {
|
|
95
|
+
this.setState(prevState => ({
|
|
96
|
+
pageNumber: prevState.pageNumber + 1
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
this.handleClickPreviousPage = () => {
|
|
101
|
+
this.setState(prevState => ({
|
|
102
|
+
pageNumber: prevState.pageNumber - 1
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
componentDidMount() {
|
|
108
|
+
this.updateDimensions();
|
|
109
|
+
window.addEventListener('resize', this.updateDimensions.bind(this));
|
|
110
|
+
/* eslint-disable */
|
|
111
|
+
|
|
112
|
+
Document = require('react-pdf').Document;
|
|
113
|
+
Page = require('react-pdf').Page;
|
|
114
|
+
/* eslint-enable */
|
|
115
|
+
|
|
116
|
+
this.forceUpdate();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
componentWillUnmount() {
|
|
120
|
+
window.removeEventListener('resize', this.updateDimensions.bind(this));
|
|
121
|
+
} // Fonction appelée une fois le pdf correctement chargé
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
// Calculate & Update state of new dimensions
|
|
125
|
+
updateDimensions() {
|
|
126
|
+
if (window.innerWidth < maxWindowWidth) {
|
|
127
|
+
const updateWidth = Math.round(window.innerWidth * 100 / maxWindowWidth / 100 * maxPdfWidth);
|
|
128
|
+
this.setState({
|
|
129
|
+
width: updateWidth
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
this.setState({
|
|
133
|
+
width: maxPdfWidth
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
} // Render
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
render() {
|
|
140
|
+
const {
|
|
141
|
+
pageNumber,
|
|
142
|
+
numPages,
|
|
143
|
+
error
|
|
144
|
+
} = this.state;
|
|
145
|
+
|
|
146
|
+
const _this$props = this.props,
|
|
147
|
+
{
|
|
148
|
+
classes,
|
|
149
|
+
file,
|
|
150
|
+
displayPagination,
|
|
151
|
+
displayNavigationButtons
|
|
152
|
+
} = _this$props,
|
|
153
|
+
props = _objectWithoutProperties(_this$props, ["classes", "file", "displayPagination", "displayNavigationButtons"]);
|
|
154
|
+
|
|
155
|
+
if (!Document || !Page) return null;
|
|
156
|
+
return React.createElement("div", {
|
|
157
|
+
className: classes.root
|
|
158
|
+
}, React.createElement(Document, _extends({
|
|
159
|
+
className: classes.style,
|
|
160
|
+
file: file,
|
|
161
|
+
onLoadSuccess: this.handleLoadSuccess,
|
|
162
|
+
onLoadError: this.handleLoadError,
|
|
163
|
+
loading: _ref
|
|
164
|
+
}, props), React.createElement(Page, {
|
|
165
|
+
pageNumber: pageNumber,
|
|
166
|
+
renderAnnotations: false,
|
|
167
|
+
renderTextLayer: false,
|
|
168
|
+
width: this.state.width
|
|
169
|
+
})), !error && numPages > 1 && displayPagination && React.createElement("span", {
|
|
170
|
+
className: classes.pageNumber
|
|
171
|
+
}, "Page ", pageNumber, " sur ", numPages), !error && numPages > 1 && displayNavigationButtons && React.createElement("span", {
|
|
172
|
+
className: classes.pagesNavigation
|
|
173
|
+
}, React.createElement(HiButton, {
|
|
174
|
+
onClick: this.handleClickPreviousPage,
|
|
175
|
+
disabled: pageNumber === 1,
|
|
176
|
+
className: classes.navigationButton
|
|
177
|
+
}, _ref2), React.createElement(HiButton, {
|
|
178
|
+
onClick: this.handleClickNextPage,
|
|
179
|
+
disabled: pageNumber === numPages,
|
|
180
|
+
className: classes.navigationButton
|
|
181
|
+
}, _ref3)));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
HiPdfReader.defaultProps = {
|
|
187
|
+
displayPagination: true,
|
|
188
|
+
displayNavigationButtons: true
|
|
189
|
+
};
|
|
190
|
+
HiPdfReader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
191
|
+
/**
|
|
192
|
+
* Surcharge les classes du composant
|
|
193
|
+
*/
|
|
194
|
+
classes: PropTypes.object,
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* On affiche les boutons de navigation entre les pages si le PDF contient plusieurs pages
|
|
198
|
+
*/
|
|
199
|
+
displayNavigationButtons: PropTypes.bool,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* On affiche la pagination si le PDF contient plusieurs pages
|
|
203
|
+
*/
|
|
204
|
+
displayPagination: PropTypes.bool,
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Chemin vers le fichier PDF
|
|
208
|
+
*/
|
|
209
|
+
file: PropTypes.string.isRequired
|
|
210
|
+
} : {};
|
|
211
|
+
export default withStyles(styles, {
|
|
212
|
+
name: 'HmuiHiPdfReader',
|
|
213
|
+
index: 51
|
|
214
|
+
})(HiPdfReader);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './HiPdfReader';
|
package/es/HiPin/HiPin.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// @inheritedComponent Radio
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { withStyles } from '../styles';
|
|
5
|
+
import Radio from '@material-ui/core/Radio';
|
|
6
|
+
export const styles = theme => ({
|
|
7
|
+
checked: {
|
|
8
|
+
color: theme.palette.neutral.main
|
|
9
|
+
},
|
|
10
|
+
disabled: {
|
|
11
|
+
color: theme.palette.action.disabled
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const HiRadio = ({
|
|
16
|
+
checked,
|
|
17
|
+
classes,
|
|
18
|
+
className,
|
|
19
|
+
color,
|
|
20
|
+
disabled,
|
|
21
|
+
label,
|
|
22
|
+
onChange,
|
|
23
|
+
value
|
|
24
|
+
}) => {
|
|
25
|
+
const hcolor = ['positive', 'negative', 'middle', 'neutral', 'inherit'].includes(color) ? 'default' : color;
|
|
26
|
+
return React.createElement(Radio, {
|
|
27
|
+
className: className,
|
|
28
|
+
classes: {
|
|
29
|
+
checked: classes.checked,
|
|
30
|
+
disabled: classes.disabled
|
|
31
|
+
},
|
|
32
|
+
checked: checked,
|
|
33
|
+
color: hcolor,
|
|
34
|
+
label: label,
|
|
35
|
+
onChange: onChange,
|
|
36
|
+
disabled: disabled,
|
|
37
|
+
value: value
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
HiRadio.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
42
|
+
checked: PropTypes.bool,
|
|
43
|
+
classes: PropTypes.object,
|
|
44
|
+
className: PropTypes.string,
|
|
45
|
+
color: PropTypes.oneOf(['inherit', 'primary', 'secondary', 'positive', 'negative', 'middle', 'neutral']),
|
|
46
|
+
disabled: PropTypes.bool,
|
|
47
|
+
label: PropTypes.string,
|
|
48
|
+
onChange: PropTypes.func,
|
|
49
|
+
value: PropTypes.string
|
|
50
|
+
} : {};
|
|
51
|
+
HiRadio.defaultProps = {};
|
|
52
|
+
export default withStyles(styles, {
|
|
53
|
+
hiComponent: true,
|
|
54
|
+
name: 'HmuiHiRadio'
|
|
55
|
+
})(HiRadio);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './HiRadio';
|
package/es/HiSelect/HiSelect.js
CHANGED
|
@@ -70,28 +70,6 @@ class HiSelect extends React.PureComponent {
|
|
|
70
70
|
constructor(_props) {
|
|
71
71
|
super(_props);
|
|
72
72
|
|
|
73
|
-
this.handleClick = () => {
|
|
74
|
-
if (this.state.open) {
|
|
75
|
-
this.handleClose();
|
|
76
|
-
} else {
|
|
77
|
-
this.setState({
|
|
78
|
-
open: true
|
|
79
|
-
});
|
|
80
|
-
const options = this.props.options.slice();
|
|
81
|
-
this.handleSuggestions(options);
|
|
82
|
-
|
|
83
|
-
if (this.props.onClick) {
|
|
84
|
-
this.props.onClick();
|
|
85
|
-
} // Gestion du focus
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (!this.props.searchable) {
|
|
89
|
-
// sinon focus sur le dernier élément selectionné
|
|
90
|
-
this.focusOnSelectedItem();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
73
|
this.buildHierarchyTrees = props => {
|
|
96
74
|
// Construct two associative arrays
|
|
97
75
|
// hierarchy[parentId] => children
|
|
@@ -153,6 +131,61 @@ class HiSelect extends React.PureComponent {
|
|
|
153
131
|
}, 1);
|
|
154
132
|
};
|
|
155
133
|
|
|
134
|
+
this.handleBlur = () => {
|
|
135
|
+
this.setState({
|
|
136
|
+
focused: false
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
this.handleClick = () => {
|
|
141
|
+
if (this.state.open) {
|
|
142
|
+
this.handleClose();
|
|
143
|
+
} else {
|
|
144
|
+
this.setState({
|
|
145
|
+
open: true
|
|
146
|
+
});
|
|
147
|
+
const options = this.props.options.slice();
|
|
148
|
+
this.handleSuggestions(options);
|
|
149
|
+
|
|
150
|
+
if (this.props.onClick) {
|
|
151
|
+
this.props.onClick();
|
|
152
|
+
} // Gestion du focus
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
if (!this.props.searchable) {
|
|
156
|
+
// sinon focus sur le dernier élément selectionné
|
|
157
|
+
this.focusOnSelectedItem();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
this.handleClickAway = event => {
|
|
163
|
+
// Au clic sur le bouton, on laisse le handleClick fermer le select
|
|
164
|
+
if (!this.selectInputElement.contains(event.target)) {
|
|
165
|
+
this.handleClose(event);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
this.handleClose = () => {
|
|
170
|
+
if (this.props.onClose) {
|
|
171
|
+
this.props.onClose();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (this.selectInputElement) {
|
|
175
|
+
this.selectInputElement.focus();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this.setState({
|
|
179
|
+
open: false
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
this.handleFocus = () => {
|
|
184
|
+
this.setState({
|
|
185
|
+
focused: true
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
156
189
|
this.handleKeyDown = event => {
|
|
157
190
|
let nextItem;
|
|
158
191
|
|
|
@@ -186,36 +219,24 @@ class HiSelect extends React.PureComponent {
|
|
|
186
219
|
}
|
|
187
220
|
};
|
|
188
221
|
|
|
189
|
-
this.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
this.handleBlur = () => {
|
|
196
|
-
this.setState({
|
|
197
|
-
focused: false
|
|
198
|
-
});
|
|
222
|
+
this.handleRequestDelete = event => {
|
|
223
|
+
event.stopPropagation();
|
|
224
|
+
this.props.onChange(this.props.name, []);
|
|
199
225
|
};
|
|
200
226
|
|
|
201
|
-
this.
|
|
202
|
-
if (this.props.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (this.selectInputElement) {
|
|
207
|
-
this.selectInputElement.focus();
|
|
227
|
+
this.handleReset = event => {
|
|
228
|
+
if (this.props.onReset) {
|
|
229
|
+
event.stopPropagation();
|
|
230
|
+
this.props.onReset(event);
|
|
208
231
|
}
|
|
209
|
-
|
|
210
|
-
this.setState({
|
|
211
|
-
open: false
|
|
212
|
-
});
|
|
213
232
|
};
|
|
214
233
|
|
|
215
|
-
this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
this.
|
|
234
|
+
this.handleScroll = event => {
|
|
235
|
+
if (!this.props.loadingMoreResults && this.props.hasMore && event.target.scrollHeight - event.target.clientHeight - event.target.scrollTop < 15) {
|
|
236
|
+
this.props.loadMoreResults(this.state.resultsPageNumber + 1);
|
|
237
|
+
this.setState(prevState => ({
|
|
238
|
+
resultsPageNumber: prevState.resultsPageNumber + 1
|
|
239
|
+
}));
|
|
219
240
|
}
|
|
220
241
|
};
|
|
221
242
|
|
|
@@ -386,20 +407,6 @@ class HiSelect extends React.PureComponent {
|
|
|
386
407
|
});
|
|
387
408
|
};
|
|
388
409
|
|
|
389
|
-
this.handleRequestDelete = evt => {
|
|
390
|
-
evt.stopPropagation();
|
|
391
|
-
this.props.onChange(this.props.name, []);
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
this.handleScroll = event => {
|
|
395
|
-
if (!this.props.loadingMoreResults && this.props.hasMore && event.target.scrollHeight - event.target.clientHeight - event.target.scrollTop < 15) {
|
|
396
|
-
this.props.loadMoreResults(this.state.resultsPageNumber + 1);
|
|
397
|
-
this.setState(prevState => ({
|
|
398
|
-
resultsPageNumber: prevState.resultsPageNumber + 1
|
|
399
|
-
}));
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
|
|
403
410
|
this.state = {
|
|
404
411
|
open: false,
|
|
405
412
|
focused: false,
|
|
@@ -455,16 +462,6 @@ class HiSelect extends React.PureComponent {
|
|
|
455
462
|
} else if (!_props.dynamic) {
|
|
456
463
|
this.state.dynamic = true;
|
|
457
464
|
}
|
|
458
|
-
|
|
459
|
-
this.handleSelect = this.handleSelect.bind(this);
|
|
460
|
-
this.handleClick = this.handleClick.bind(this);
|
|
461
|
-
this.handleClose = this.handleClose.bind(this);
|
|
462
|
-
this.handleClickAway = this.handleClickAway.bind(this);
|
|
463
|
-
this.handleRequestDelete = this.handleRequestDelete.bind(this);
|
|
464
|
-
this.handleSuggestions = this.handleSuggestions.bind(this);
|
|
465
|
-
this.handleFocus = this.handleFocus.bind(this);
|
|
466
|
-
this.handleBlur = this.handleBlur.bind(this);
|
|
467
|
-
this.handleScroll = this.handleScroll.bind(this);
|
|
468
465
|
}
|
|
469
466
|
|
|
470
467
|
componentWillReceiveProps(nextProps) {
|
|
@@ -490,13 +487,6 @@ class HiSelect extends React.PureComponent {
|
|
|
490
487
|
}
|
|
491
488
|
}
|
|
492
489
|
|
|
493
|
-
handleReset(event) {
|
|
494
|
-
if (this.props.onReset) {
|
|
495
|
-
event.stopPropagation();
|
|
496
|
-
this.props.onReset(event);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
490
|
render() {
|
|
501
491
|
const _this$props = this.props,
|
|
502
492
|
{
|
|
@@ -12,6 +12,7 @@ import HiInput from '../HiForm/HiInput';
|
|
|
12
12
|
import { withStyles } from '../styles';
|
|
13
13
|
import Popper from '@material-ui/core/Popper';
|
|
14
14
|
import { getNextItemSelectable } from '../utils/helpers';
|
|
15
|
+
import keycode from 'keycode';
|
|
15
16
|
export const styles = theme => ({
|
|
16
17
|
root: {
|
|
17
18
|
backgroundColor: theme.palette.background2,
|
|
@@ -64,13 +65,20 @@ class HiSuggestSelect extends React.PureComponent {
|
|
|
64
65
|
|
|
65
66
|
this.handleKeyDown = event => {
|
|
66
67
|
let nextItem;
|
|
68
|
+
const key = keycode(event);
|
|
67
69
|
|
|
68
|
-
if (
|
|
70
|
+
if (key === 'down') {
|
|
71
|
+
event.preventDefault();
|
|
69
72
|
nextItem = getNextItemSelectable(document.activeElement, 'down');
|
|
70
|
-
} else if (
|
|
73
|
+
} else if (key === 'up') {
|
|
74
|
+
event.preventDefault();
|
|
71
75
|
nextItem = getNextItemSelectable(document.activeElement, 'up');
|
|
72
|
-
} else if (
|
|
76
|
+
} else if (key === 'tab') {
|
|
73
77
|
document.body.style.overflow = 'auto';
|
|
78
|
+
} else if (key === 'escape' || 'enter') {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
const item = this.props.options.find(elem => String(elem.id) === event.target.id);
|
|
81
|
+
this.handleSelect(null, item);
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
if (nextItem) {
|
|
@@ -117,10 +125,14 @@ class HiSuggestSelect extends React.PureComponent {
|
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
handleFocus() {
|
|
128
|
+
handleFocus(event) {
|
|
121
129
|
this.setState({
|
|
122
130
|
focused: true
|
|
123
131
|
});
|
|
132
|
+
|
|
133
|
+
if (this.props.onFocusInput) {
|
|
134
|
+
this.props.onFocusInput(event);
|
|
135
|
+
}
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
handleBlur(event) {
|
|
@@ -132,6 +144,10 @@ class HiSuggestSelect extends React.PureComponent {
|
|
|
132
144
|
focused: false
|
|
133
145
|
});
|
|
134
146
|
}
|
|
147
|
+
|
|
148
|
+
if (this.props.onBlurInput) {
|
|
149
|
+
this.props.onBlurInput(event);
|
|
150
|
+
}
|
|
135
151
|
}
|
|
136
152
|
|
|
137
153
|
render() {
|
|
@@ -253,6 +269,16 @@ HiSuggestSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
253
269
|
*/
|
|
254
270
|
loading: PropTypes.bool,
|
|
255
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Fonction de callback appelée lorsqu'on blur le champ de recherche
|
|
274
|
+
*/
|
|
275
|
+
onBlurInput: PropTypes.func,
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Fonction de callback appelée lorsqu'on focus le champs de recherche
|
|
279
|
+
*/
|
|
280
|
+
onFocusInput: PropTypes.func,
|
|
281
|
+
|
|
256
282
|
/**
|
|
257
283
|
* Fonction de callback appelée lorsqu'on écrit dans le champ
|
|
258
284
|
*/
|
|
@@ -13,7 +13,10 @@ export const styles = theme => ({
|
|
|
13
13
|
maxWidth: 500,
|
|
14
14
|
display: 'flex',
|
|
15
15
|
justifyContent: 'center',
|
|
16
|
-
|
|
16
|
+
paddingTop: 7,
|
|
17
|
+
paddingBottom: 9,
|
|
18
|
+
paddingRight: 8,
|
|
19
|
+
paddingLeft: 8,
|
|
17
20
|
cursor: 'pointer'
|
|
18
21
|
},
|
|
19
22
|
underline: {
|
|
@@ -300,6 +303,11 @@ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
300
303
|
*/
|
|
301
304
|
refElement: PropTypes.func,
|
|
302
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Theme object
|
|
308
|
+
*/
|
|
309
|
+
theme: PropTypes.object,
|
|
310
|
+
|
|
303
311
|
/**
|
|
304
312
|
* Valeur à afficher (déjà formattée)
|
|
305
313
|
*/
|
|
@@ -175,7 +175,6 @@ class HiNestedSelectContent extends React.PureComponent {
|
|
|
175
175
|
|
|
176
176
|
this.buildSelectProps = (options, value = [], search = '', loading = false) => {
|
|
177
177
|
const {
|
|
178
|
-
classes,
|
|
179
178
|
disabledParent,
|
|
180
179
|
hasAll,
|
|
181
180
|
iconAll,
|
|
@@ -291,6 +290,11 @@ HiNestedSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
291
290
|
*/
|
|
292
291
|
hasAll: PropTypes.bool,
|
|
293
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Propriétés du composant HiSelectableList
|
|
295
|
+
*/
|
|
296
|
+
hiSelectableListProps: PropTypes.object,
|
|
297
|
+
|
|
294
298
|
/**
|
|
295
299
|
* id du select
|
|
296
300
|
*/
|