@hipay/hipay-material-ui 1.0.0-beta.19 → 1.0.0-beta.20
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/HiChip/HiChip.js +12 -2
- package/HiDatePicker/HiDateRangePicker.js +1 -1
- package/HiDatePicker/HiDateRangeSelector.js +5 -4
- package/HiDatePicker/stylesheet.js +4 -0
- package/HiForm/HiAddressField.js +32 -49
- package/HiForm/HiInput.js +11 -6
- package/HiForm/HiUpload.js +280 -0
- package/HiForm/HiUploadField.js +456 -0
- package/HiForm/index.js +18 -0
- package/HiMap/HiMap.js +367 -0
- package/HiMap/HiMapExpand.js +217 -0
- package/HiMap/index.js +25 -0
- package/HiSelect/HiSelect.js +1 -1
- package/HiTable/BodyCellBuilder.js +1 -1
- package/HiTable/BodyCells/CellCountry.js +1 -1
- package/HiTable/BodyCells/CellImage.js +6 -6
- package/HiTable/BodyCells/CellLayout.js +1 -1
- package/HiTable/HeaderCell.js +5 -4
- package/HiTable/HiTableFooter.js +2 -1
- package/HiTopBar/HiTopBar.js +6 -4
- package/es/HiChip/HiChip.js +11 -2
- package/es/HiDatePicker/HiDateRangePicker.js +1 -1
- package/es/HiDatePicker/HiDateRangeSelector.js +5 -4
- package/es/HiDatePicker/stylesheet.js +4 -0
- package/es/HiForm/HiAddressField.js +30 -45
- package/es/HiForm/HiInput.js +10 -5
- package/es/HiForm/HiUpload.js +194 -0
- package/es/HiForm/HiUploadField.js +368 -0
- package/es/HiForm/index.js +2 -0
- package/es/HiMap/HiMap.js +285 -0
- package/es/HiMap/HiMapExpand.js +145 -0
- package/es/HiMap/index.js +2 -0
- package/es/HiSelect/HiSelect.js +1 -1
- package/es/HiTable/BodyCellBuilder.js +1 -1
- package/es/HiTable/BodyCells/CellCountry.js +1 -1
- package/es/HiTable/BodyCells/CellImage.js +6 -6
- package/es/HiTable/BodyCells/CellLayout.js +1 -1
- package/es/HiTable/HeaderCell.js +5 -3
- package/es/HiTable/HiTableFooter.js +2 -1
- package/es/HiTopBar/HiTopBar.js +6 -4
- package/es/styles/createHiMuiTheme.js +2 -0
- package/hmu/images/map_marker.svg +8 -0
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +44 -42
- package/styles/createHiMuiTheme.js +2 -0
- package/umd/hipay-material-ui.development.js +58049 -14511
- package/umd/hipay-material-ui.production.min.js +5 -5
package/HiChip/HiChip.js
CHANGED
@@ -81,9 +81,12 @@ var styles = exports.styles = function styles(theme) {
|
|
81
81
|
whiteSpace: 'nowrap',
|
82
82
|
color: theme.palette.neutral.dark,
|
83
83
|
overflow: 'hidden',
|
84
|
-
width: '100%',
|
85
84
|
textOverflow: 'ellipsis'
|
86
85
|
},
|
86
|
+
prefix: {
|
87
|
+
color: theme.palette.neutral.dark,
|
88
|
+
paddingRight: 4
|
89
|
+
},
|
87
90
|
navigate: {
|
88
91
|
// Remove grey highlight
|
89
92
|
WebkitTapHighlightColor: 'transparent',
|
@@ -115,7 +118,8 @@ function HiChip(props) {
|
|
115
118
|
img = props.img,
|
116
119
|
onPrevious = props.onPrevious,
|
117
120
|
onNext = props.onNext,
|
118
|
-
onDelete = props.onDelete
|
121
|
+
onDelete = props.onDelete,
|
122
|
+
prefix = props.prefix;
|
119
123
|
|
120
124
|
|
121
125
|
return _react2.default.createElement(
|
@@ -123,6 +127,12 @@ function HiChip(props) {
|
|
123
127
|
{
|
124
128
|
className: (0, _classnames2.default)(classes.root, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.leftNavigation, onPrevious), (0, _defineProperty3.default)(_classNames, classes.rightNavigation, onNext), (0, _defineProperty3.default)(_classNames, classes.deletable, onDelete), _classNames))
|
125
129
|
},
|
130
|
+
prefix && _react2.default.createElement(
|
131
|
+
'span',
|
132
|
+
{ className: classes.prefix },
|
133
|
+
prefix,
|
134
|
+
' : '
|
135
|
+
),
|
126
136
|
img && _react2.default.createElement('img', { className: classes.badge, src: img, alt: img }),
|
127
137
|
icon && _react2.default.createElement(_HiIconBuilder2.default, { className: classes.icon, icon: icon, size: 16 }),
|
128
138
|
onPrevious && _react2.default.createElement(_HiIconBuilder2.default, {
|
@@ -601,7 +601,7 @@ var HiDateRangePicker = function (_React$Component) {
|
|
601
601
|
|
602
602
|
return _react2.default.createElement(
|
603
603
|
'div',
|
604
|
-
{ className: classes.root },
|
604
|
+
{ className: (0, _classnames2.default)(classes.root, classes.rangePickerContainer) },
|
605
605
|
_react2.default.createElement(
|
606
606
|
'div',
|
607
607
|
{
|
@@ -86,9 +86,9 @@ function buildDateRangeOptionByKey(key, t, format) {
|
|
86
86
|
break;
|
87
87
|
case 'cd':
|
88
88
|
label = t.today;
|
89
|
-
from = (0, _moment2.default)().
|
90
|
-
to = (0, _moment2.default)();
|
91
|
-
info =
|
89
|
+
from = (0, _moment2.default)().startOf('day');
|
90
|
+
to = (0, _moment2.default)().endOf('day');
|
91
|
+
info = '' + from.format(format);
|
92
92
|
break;
|
93
93
|
case 'pd':
|
94
94
|
label = t.yesterday;
|
@@ -156,7 +156,8 @@ var styles = exports.styles = function styles(theme) {
|
|
156
156
|
return {
|
157
157
|
root: {
|
158
158
|
maxWidth: 500,
|
159
|
-
marginLeft: -4
|
159
|
+
marginLeft: -4,
|
160
|
+
alignItems: 'flex-start'
|
160
161
|
},
|
161
162
|
dateSelect: {
|
162
163
|
paddingTop: 1,
|
package/HiForm/HiAddressField.js
CHANGED
@@ -57,31 +57,26 @@ var HiAddressField = function (_React$Component) {
|
|
57
57
|
|
58
58
|
var _this = (0, _possibleConstructorReturn3.default)(this, (HiAddressField.__proto__ || (0, _getPrototypeOf2.default)(HiAddressField)).call(this, props));
|
59
59
|
|
60
|
-
_this.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
//
|
66
|
-
|
67
|
-
//
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
type: 'icon'
|
81
|
-
});
|
82
|
-
}, _this);
|
83
|
-
_this.setState({ options: options, isExact: isExact });
|
84
|
-
}
|
60
|
+
_this.displaySuggestions = function (predictions) {
|
61
|
+
// Sinon je mets à jour les options du champ avec les prédictions de GMaps
|
62
|
+
var options = [];
|
63
|
+
var isExact = false;
|
64
|
+
predictions.forEach(function (prediction) {
|
65
|
+
// Si le texte saisi est identique à une des propositions,
|
66
|
+
// on estime que la valeur de l'adresse est exacte,
|
67
|
+
// même sans clic sur une proposition
|
68
|
+
isExact = prediction.display_name === _this.value ? true : isExact;
|
69
|
+
// liste des types d'adresse : https://github.com/openstreetmap/Nominatim/blob/80df4d3b560f5b1fd550dcf8cdc09a992b69fee0/settings/partitionedtags.def
|
70
|
+
options.push({
|
71
|
+
id: prediction.place_id,
|
72
|
+
label: prediction.display_name,
|
73
|
+
labelHighlight: prediction.display_name.replace(new RegExp(_this.value, 'gi'), '<strong>$&</strong>'),
|
74
|
+
icon: ['amenity', 'building'].includes(prediction.category) ? 'domain' : 'map_marker',
|
75
|
+
type: 'icon',
|
76
|
+
key: prediction.id
|
77
|
+
});
|
78
|
+
}, _this);
|
79
|
+
_this.setState({ options: options, isExact: isExact });
|
85
80
|
};
|
86
81
|
|
87
82
|
_this.state = {
|
@@ -96,17 +91,7 @@ var HiAddressField = function (_React$Component) {
|
|
96
91
|
return _this;
|
97
92
|
}
|
98
93
|
|
99
|
-
/**
|
100
|
-
* Au chargement du composant, je définis mon service autocomplete GMaps
|
101
|
-
*/
|
102
|
-
|
103
|
-
|
104
94
|
(0, _createClass3.default)(HiAddressField, [{
|
105
|
-
key: 'componentDidMount',
|
106
|
-
value: function componentDidMount() {
|
107
|
-
this.autocompleteService = new google.maps.places.AutocompleteService();
|
108
|
-
}
|
109
|
-
}, {
|
110
95
|
key: 'handleReset',
|
111
96
|
value: function handleReset() {
|
112
97
|
this.props.onReset();
|
@@ -118,25 +103,23 @@ var HiAddressField = function (_React$Component) {
|
|
118
103
|
}, {
|
119
104
|
key: 'handleSearch',
|
120
105
|
value: function handleSearch(event) {
|
106
|
+
var _this2 = this;
|
107
|
+
|
121
108
|
// Je vérifie que le champ n'est pas vide car l'API lève une exception en cas d'input vide
|
122
109
|
if (event.target.value) {
|
123
|
-
// Liste des types à rechercher. Voir https://developers.google.com/places/web-service/autocomplete?hl=fr#place_types (ex : ['establishement', 'address']
|
124
|
-
var types = [];
|
125
|
-
// Liste des codes ISO Alpha-2 des pays où il faut rechercher (ex : ['fr', 'us'])
|
126
|
-
var countries = [];
|
127
110
|
// À chaque changement, la méthode getPlacesPredictions appelle la méthode
|
128
111
|
// displaySuggestions en lui fournissant un tableau de 5 prédictions
|
129
112
|
this.value = event.target.value;
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
|
139
|
-
|
113
|
+
var xhr = new XMLHttpRequest();
|
114
|
+
xhr.onreadystatechange = function () {
|
115
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
116
|
+
var response = JSON.parse(xhr.responseText);
|
117
|
+
_this2.displaySuggestions(response, 'OK');
|
118
|
+
}
|
119
|
+
};
|
120
|
+
xhr.open('GET', 'https://nominatim.openstreetmap.org/search?q=' + event.target.value + '&format=jsonv2&limit=5&bounded=1&dedupe=1&namedetails=1', true);
|
121
|
+
xhr.setRequestHeader('Content-type', 'application/json');
|
122
|
+
xhr.send();
|
140
123
|
}
|
141
124
|
this.props.onSearch(event);
|
142
125
|
// Mise à jour du texte dans l'input
|
package/HiForm/HiInput.js
CHANGED
@@ -122,7 +122,6 @@ var styles = exports.styles = function styles(theme) {
|
|
122
122
|
color: theme.palette.neutral.light
|
123
123
|
},
|
124
124
|
rightIcon: {
|
125
|
-
margin: '0 8px',
|
126
125
|
width: 18,
|
127
126
|
height: 39,
|
128
127
|
color: theme.palette.neutral.normal
|
@@ -135,7 +134,7 @@ var styles = exports.styles = function styles(theme) {
|
|
135
134
|
},
|
136
135
|
rightIconError: {
|
137
136
|
// Ajout d'1px pour ne pas avoir de décalage en mode error avec le border right
|
138
|
-
marginRight:
|
137
|
+
marginRight: '-1px'
|
139
138
|
},
|
140
139
|
input: (0, _extends3.default)({}, theme.typography.body1, {
|
141
140
|
fontWeight: theme.typography.fontWeightRegular,
|
@@ -247,7 +246,6 @@ var HiInput = function (_React$PureComponent) {
|
|
247
246
|
if (this.props.onFocus) {
|
248
247
|
this.props.onFocus(event);
|
249
248
|
}
|
250
|
-
this.inputElement.focus();
|
251
249
|
}
|
252
250
|
}
|
253
251
|
}, {
|
@@ -329,6 +327,8 @@ var HiInput = function (_React$PureComponent) {
|
|
329
327
|
|
330
328
|
leftIcon = _react2.default.createElement(_HiIconBuilder2.default, {
|
331
329
|
icon: startAdornment,
|
330
|
+
size: 36,
|
331
|
+
style: { padding: '8px' },
|
332
332
|
onClick: this.props.onLeftIconClick,
|
333
333
|
className: (0, _classnames2.default)(classes.startAdornment, (_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, classes.startAdornmentFocus, focused), (0, _defineProperty3.default)(_classNames2, classes.startAdornmentDisabled, disabled), (0, _defineProperty3.default)(_classNames2, classes.iconPointer, this.props.onLeftIconClick), _classNames2))
|
334
334
|
});
|
@@ -341,7 +341,7 @@ var HiInput = function (_React$PureComponent) {
|
|
341
341
|
onClick: this.handleReset,
|
342
342
|
onBlur: this.handleBlur
|
343
343
|
},
|
344
|
-
_react2.default.createElement(_HiIconBuilder2.default, { icon: 'close', size:
|
344
|
+
_react2.default.createElement(_HiIconBuilder2.default, { icon: 'close', size: 36, color: theme.palette.neutral.normal, style: { padding: '8px' } })
|
345
345
|
);
|
346
346
|
|
347
347
|
var endAdornment = endAdornmentProps;
|
@@ -350,6 +350,8 @@ var HiInput = function (_React$PureComponent) {
|
|
350
350
|
|
351
351
|
endAdornment = _react2.default.createElement(_HiIconBuilder2.default, {
|
352
352
|
icon: endAdornmentProps,
|
353
|
+
size: 36,
|
354
|
+
style: { padding: '8px' },
|
353
355
|
onClick: this.props.onRightIconClick,
|
354
356
|
className: (0, _classnames2.default)(classes.rightIcon, (_classNames3 = {}, (0, _defineProperty3.default)(_classNames3, classes.rightIconFocus, focused), (0, _defineProperty3.default)(_classNames3, classes.rightIconDisabled, disabled), (0, _defineProperty3.default)(_classNames3, classes.rightIconError, error), (0, _defineProperty3.default)(_classNames3, classes.iconPointer, this.props.onRightIconClick), _classNames3))
|
355
357
|
});
|
@@ -380,9 +382,12 @@ var HiInput = function (_React$PureComponent) {
|
|
380
382
|
startAdornment: leftIcon,
|
381
383
|
endAdornment: _react2.default.createElement(
|
382
384
|
'div',
|
383
|
-
{
|
385
|
+
{
|
386
|
+
className: classes.endAdornment,
|
387
|
+
ref: function ref(el) {
|
384
388
|
return _this2.endAdornmentNode = el;
|
385
|
-
}
|
389
|
+
}
|
390
|
+
},
|
386
391
|
eraseIcon,
|
387
392
|
endAdornment
|
388
393
|
),
|
@@ -0,0 +1,280 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.styles = undefined;
|
7
|
+
|
8
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
9
|
+
|
10
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
11
|
+
|
12
|
+
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
13
|
+
|
14
|
+
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
15
|
+
|
16
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
17
|
+
|
18
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
19
|
+
|
20
|
+
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
21
|
+
|
22
|
+
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
23
|
+
|
24
|
+
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
25
|
+
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
27
|
+
|
28
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
29
|
+
|
30
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
31
|
+
|
32
|
+
var _createClass2 = require('babel-runtime/helpers/createClass');
|
33
|
+
|
34
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
35
|
+
|
36
|
+
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
37
|
+
|
38
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
39
|
+
|
40
|
+
var _inherits2 = require('babel-runtime/helpers/inherits');
|
41
|
+
|
42
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
43
|
+
|
44
|
+
var _react = require('react');
|
45
|
+
|
46
|
+
var _react2 = _interopRequireDefault(_react);
|
47
|
+
|
48
|
+
var _propTypes = require('prop-types');
|
49
|
+
|
50
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
51
|
+
|
52
|
+
var _classnames = require('classnames');
|
53
|
+
|
54
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
55
|
+
|
56
|
+
var _withStyles = require('../styles/withStyles');
|
57
|
+
|
58
|
+
var _withStyles2 = _interopRequireDefault(_withStyles);
|
59
|
+
|
60
|
+
var _withTheme = require('../styles/withTheme');
|
61
|
+
|
62
|
+
var _withTheme2 = _interopRequireDefault(_withTheme);
|
63
|
+
|
64
|
+
var _HiFormControl = require('./HiFormControl');
|
65
|
+
|
66
|
+
var _HiFormControl2 = _interopRequireDefault(_HiFormControl);
|
67
|
+
|
68
|
+
var _HiUploadField = require('./HiUploadField');
|
69
|
+
|
70
|
+
var _HiUploadField2 = _interopRequireDefault(_HiUploadField);
|
71
|
+
|
72
|
+
var _HiIconBuilder = require('../utils/HiIconBuilder');
|
73
|
+
|
74
|
+
var _HiIconBuilder2 = _interopRequireDefault(_HiIconBuilder);
|
75
|
+
|
76
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
77
|
+
|
78
|
+
// @inheritedComponent HiUploadField
|
79
|
+
|
80
|
+
var styles = exports.styles = function styles(theme) {
|
81
|
+
return {
|
82
|
+
flexContainer: {
|
83
|
+
display: ' flex',
|
84
|
+
alignItems: 'center'
|
85
|
+
},
|
86
|
+
statusIcon: {
|
87
|
+
color: theme.palette.text.icon,
|
88
|
+
marginRight: '8px',
|
89
|
+
padding: '24px',
|
90
|
+
borderRadius: '2px',
|
91
|
+
border: '1px solid ' + theme.palette.input.bottomLine,
|
92
|
+
backgroundColor: theme.palette.local.background2,
|
93
|
+
'&:not($empty)': {
|
94
|
+
border: '1px solid ' + theme.palette.middle.normal,
|
95
|
+
color: '' + theme.palette.middle.normal
|
96
|
+
},
|
97
|
+
'&$complete': {
|
98
|
+
border: '1px solid ' + theme.palette.positive.normal,
|
99
|
+
color: '' + theme.palette.positive.normal
|
100
|
+
},
|
101
|
+
'&$error': {
|
102
|
+
border: '1px solid ' + theme.palette.negative.normal,
|
103
|
+
color: '' + theme.palette.negative.normal
|
104
|
+
}
|
105
|
+
},
|
106
|
+
inputContainer: {
|
107
|
+
flex: '1'
|
108
|
+
},
|
109
|
+
empty: {},
|
110
|
+
complete: {},
|
111
|
+
error: {}
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
var HiUpload = function (_React$PureComponent) {
|
116
|
+
(0, _inherits3.default)(HiUpload, _React$PureComponent);
|
117
|
+
|
118
|
+
function HiUpload(props) {
|
119
|
+
(0, _classCallCheck3.default)(this, HiUpload);
|
120
|
+
|
121
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (HiUpload.__proto__ || (0, _getPrototypeOf2.default)(HiUpload)).call(this, props));
|
122
|
+
|
123
|
+
_this.state = {
|
124
|
+
params: new Array(_this.props.inputs.length)
|
125
|
+
};
|
126
|
+
|
127
|
+
_this.handleChange = _this.handleChange.bind(_this);
|
128
|
+
_this.handleClear = _this.handleClear.bind(_this);
|
129
|
+
_this.handleSeeFile = _this.handleSeeFile.bind(_this);
|
130
|
+
return _this;
|
131
|
+
}
|
132
|
+
|
133
|
+
(0, _createClass3.default)(HiUpload, [{
|
134
|
+
key: 'handleChange',
|
135
|
+
value: function handleChange(param, index) {
|
136
|
+
this.setState(function (prevState) {
|
137
|
+
var oldParams = [].concat((0, _toConsumableArray3.default)(prevState.params));
|
138
|
+
oldParams.splice(index, 1, param);
|
139
|
+
return {
|
140
|
+
params: oldParams
|
141
|
+
};
|
142
|
+
});
|
143
|
+
}
|
144
|
+
}, {
|
145
|
+
key: 'handleClear',
|
146
|
+
value: function handleClear(index) {
|
147
|
+
this.setState(function (prevState) {
|
148
|
+
var oldParams = [].concat((0, _toConsumableArray3.default)(prevState.params));
|
149
|
+
oldParams.splice(index, 1, undefined);
|
150
|
+
return {
|
151
|
+
params: oldParams
|
152
|
+
};
|
153
|
+
});
|
154
|
+
}
|
155
|
+
}, {
|
156
|
+
key: 'handleSeeFile',
|
157
|
+
value: function handleSeeFile(file) {
|
158
|
+
this.props.onSeeFile(file);
|
159
|
+
}
|
160
|
+
}, {
|
161
|
+
key: 'render',
|
162
|
+
value: function render() {
|
163
|
+
var _classNames,
|
164
|
+
_this2 = this;
|
165
|
+
|
166
|
+
var _props = this.props,
|
167
|
+
inputs = _props.inputs,
|
168
|
+
className = _props.className,
|
169
|
+
classes = _props.classes,
|
170
|
+
label = _props.label,
|
171
|
+
helperIcon = _props.helperIcon,
|
172
|
+
helperText = _props.helperText,
|
173
|
+
others = (0, _objectWithoutProperties3.default)(_props, ['inputs', 'className', 'classes', 'label', 'helperIcon', 'helperText']);
|
174
|
+
var params = this.state.params;
|
175
|
+
|
176
|
+
|
177
|
+
var complete = true;
|
178
|
+
var empty = true;
|
179
|
+
var error = false;
|
180
|
+
var errorText = '';
|
181
|
+
|
182
|
+
for (var i = 0, len = params.length; i < len; i += 1) {
|
183
|
+
var param = params[i];
|
184
|
+
if (param !== undefined) {
|
185
|
+
complete = param.value === null || param.error ? false : complete;
|
186
|
+
empty = param.value !== null && !param.error ? false : empty;
|
187
|
+
error = param.error || error;
|
188
|
+
errorText = errorText || param.errorMessage;
|
189
|
+
} else {
|
190
|
+
complete = false;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
var statusClass = (0, _classnames2.default)(classes.statusIcon, (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes.empty, empty), (0, _defineProperty3.default)(_classNames, classes.complete, complete), (0, _defineProperty3.default)(_classNames, classes.error, error), _classNames));
|
195
|
+
|
196
|
+
var icon = void 0;
|
197
|
+
|
198
|
+
if (error) {
|
199
|
+
icon = 'alert';
|
200
|
+
} else if (complete) {
|
201
|
+
icon = 'check_circle';
|
202
|
+
} else {
|
203
|
+
icon = 'upload';
|
204
|
+
}
|
205
|
+
|
206
|
+
return _react2.default.createElement(
|
207
|
+
_HiFormControl2.default,
|
208
|
+
{
|
209
|
+
label: label,
|
210
|
+
className: className,
|
211
|
+
errorText: errorText,
|
212
|
+
error: error,
|
213
|
+
helperIcon: helperIcon,
|
214
|
+
helperText: helperText
|
215
|
+
},
|
216
|
+
_react2.default.createElement(
|
217
|
+
'div',
|
218
|
+
{ className: classes.flexContainer },
|
219
|
+
_react2.default.createElement(_HiIconBuilder2.default, { className: statusClass, size: 80, icon: icon }),
|
220
|
+
_react2.default.createElement(
|
221
|
+
'div',
|
222
|
+
{ className: classes.inputContainer },
|
223
|
+
inputs.map(function (item, index) {
|
224
|
+
return _react2.default.createElement(_HiUploadField2.default, (0, _extends3.default)({
|
225
|
+
maxSize: item.maxSize,
|
226
|
+
acceptedTypes: item.acceptedTypes,
|
227
|
+
placeholder: item.placeholder,
|
228
|
+
value: params[index] ? params[index].value : null,
|
229
|
+
error: params[index] ? params[index].error : null,
|
230
|
+
errorMessage: params[index] ? params[index].errorMessage : null,
|
231
|
+
onSeeFile: _this2.handleSeeFile,
|
232
|
+
onClear: _this2.handleClear,
|
233
|
+
onChange: _this2.handleChange,
|
234
|
+
index: index,
|
235
|
+
key: item.id
|
236
|
+
}, others));
|
237
|
+
})
|
238
|
+
)
|
239
|
+
)
|
240
|
+
);
|
241
|
+
}
|
242
|
+
}]);
|
243
|
+
return HiUpload;
|
244
|
+
}(_react2.default.PureComponent);
|
245
|
+
|
246
|
+
HiUpload.defaultProps = {
|
247
|
+
helperText: '',
|
248
|
+
helperIcon: false
|
249
|
+
};
|
250
|
+
HiUpload.propTypes = process.env.NODE_ENV !== "production" ? {
|
251
|
+
/**
|
252
|
+
* Useful to extend the style applied to components.
|
253
|
+
*/
|
254
|
+
classes: _propTypes2.default.object,
|
255
|
+
/**
|
256
|
+
* Classes CSS appliquées.
|
257
|
+
*/
|
258
|
+
className: _propTypes2.default.string,
|
259
|
+
/**
|
260
|
+
* Si "true", le texte d'aide s'affichera seulement au clic sur l'icône "Information"
|
261
|
+
*/
|
262
|
+
helperIcon: _propTypes2.default.bool,
|
263
|
+
/**
|
264
|
+
* Texte de l'aide
|
265
|
+
*/
|
266
|
+
helperText: _propTypes2.default.string,
|
267
|
+
/**
|
268
|
+
* Array containing each of the inputs the component has to show (represented by an object).
|
269
|
+
*/
|
270
|
+
inputs: _propTypes2.default.array.isRequired,
|
271
|
+
/**
|
272
|
+
* The label of the global input.
|
273
|
+
*/
|
274
|
+
label: _propTypes2.default.string,
|
275
|
+
/**
|
276
|
+
* The method given to see the file.
|
277
|
+
*/
|
278
|
+
onSeeFile: _propTypes2.default.func
|
279
|
+
} : {};
|
280
|
+
exports.default = (0, _withStyles2.default)(styles, { name: 'HmuiHiUpload', withTheme: true })(HiUpload);
|