@hipay/hipay-material-ui 1.0.0-beta.14 → 1.0.0-beta.16
Sign up to get free protection for your applications and to get access to all the features.
- package/HiBreadcrumb/HiBreadcrumb.js +28 -22
- package/HiBreadcrumb/HiStep.js +96 -60
- package/HiBreadcrumb/HiStepConnector.js +91 -26
- package/HiBreadcrumb/HiStepContent.js +122 -0
- package/HiBreadcrumb/HiStepIcon.js +86 -29
- package/HiBreadcrumb/HiStepLabel.js +128 -62
- package/HiBreadcrumb/HiStepper.js +5 -24
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +3 -1
- package/HiDatePicker/Overlays/Overlay.js +14 -2
- package/HiForm/HiInput.js +24 -11
- package/HiForm/HiSlider.js +399 -0
- package/HiForm/index.js +9 -0
- package/HiTable/BodyCellBuilder.js +3 -0
- package/HiTable/BodyCells/CellIcon.js +26 -19
- package/HiTable/BodyCells/CellImage.js +17 -13
- package/HiTable/BodyCells/CellNumeric.js +7 -2
- package/HiTable/BodyCells/CellSentinel.js +14 -13
- package/HiTable/BodyCells/CellThirdPartySecurity.js +43 -19
- package/HiTable/HeaderCell.js +3 -2
- package/es/HiBreadcrumb/HiBreadcrumb.js +27 -19
- package/es/HiBreadcrumb/HiStep.js +55 -54
- package/es/HiBreadcrumb/HiStepConnector.js +86 -26
- package/es/HiBreadcrumb/HiStepContent.js +63 -0
- package/es/HiBreadcrumb/HiStepIcon.js +103 -35
- package/es/HiBreadcrumb/HiStepLabel.js +106 -63
- package/es/HiBreadcrumb/HiStepper.js +5 -21
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +3 -1
- package/es/HiDatePicker/Overlays/Overlay.js +9 -2
- package/es/HiForm/HiInput.js +19 -10
- package/es/HiForm/HiSlider.js +309 -0
- package/es/HiForm/index.js +1 -0
- package/es/HiTable/BodyCellBuilder.js +3 -0
- package/es/HiTable/BodyCells/CellIcon.js +15 -8
- package/es/HiTable/BodyCells/CellImage.js +16 -14
- package/es/HiTable/BodyCells/CellNumeric.js +6 -2
- package/es/HiTable/BodyCells/CellSentinel.js +8 -5
- package/es/HiTable/BodyCells/CellThirdPartySecurity.js +40 -15
- package/es/HiTable/HeaderCell.js +3 -2
- package/es/utils/hiHelpers.js +4 -3
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +43 -43
- package/umd/hipay-material-ui.development.js +7679 -7170
- package/umd/hipay-material-ui.production.min.js +5 -5
- package/utils/hiHelpers.js +4 -2
@@ -0,0 +1,309 @@
|
|
1
|
+
import _extends from 'babel-runtime/helpers/extends';
|
2
|
+
import React from 'react';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import classNames from 'classnames';
|
5
|
+
import withStyles from '../styles/withStyles';
|
6
|
+
import HiIconBuilder from '../utils/HiIconBuilder';
|
7
|
+
import HiFormControl from '../HiForm/HiFormControl';
|
8
|
+
|
9
|
+
export const styles = theme => ({
|
10
|
+
barContainer: {
|
11
|
+
width: '100%',
|
12
|
+
position: 'relative',
|
13
|
+
margin: '0 7px'
|
14
|
+
},
|
15
|
+
barHidden: {
|
16
|
+
width: '100%',
|
17
|
+
opacity: 0,
|
18
|
+
position: 'absolute',
|
19
|
+
top: '7px',
|
20
|
+
zIndex: '2'
|
21
|
+
},
|
22
|
+
mainContainer: _extends({}, theme.typography.body1, {
|
23
|
+
display: 'flex',
|
24
|
+
flexWrap: 'nowrap',
|
25
|
+
alignItems: 'center'
|
26
|
+
}),
|
27
|
+
topContainer: {
|
28
|
+
display: 'flex',
|
29
|
+
flexWrap: 'nowrap',
|
30
|
+
height: '18px'
|
31
|
+
},
|
32
|
+
bottomContainer: {
|
33
|
+
display: 'flex',
|
34
|
+
flexWrap: 'nowrap',
|
35
|
+
height: '18px'
|
36
|
+
},
|
37
|
+
barValue: {
|
38
|
+
display: 'flex',
|
39
|
+
width: '100%',
|
40
|
+
height: '4px',
|
41
|
+
borderRadius: '2px',
|
42
|
+
backgroundColor: theme.palette.business.primary.normal,
|
43
|
+
position: 'absolute',
|
44
|
+
zIndex: '2'
|
45
|
+
},
|
46
|
+
arrow: {
|
47
|
+
position: 'absolute',
|
48
|
+
zIndex: '1',
|
49
|
+
color: theme.palette.business.primary.normal,
|
50
|
+
transform: 'translate(-50%,-25%)',
|
51
|
+
transition: 'transform 300ms cubic-bezier(0.4, 0, 0.2, 1)',
|
52
|
+
transitionProperty: 'transform color'
|
53
|
+
},
|
54
|
+
focused: {
|
55
|
+
transform: 'scale(1.7) translate(-29%, -11%)',
|
56
|
+
color: theme.palette.business.primary.dark
|
57
|
+
},
|
58
|
+
leftLabel: {
|
59
|
+
color: theme.palette.business.primary.normal,
|
60
|
+
left: '0px',
|
61
|
+
position: 'absolute',
|
62
|
+
fontSize: '11px',
|
63
|
+
alignSelf: 'flex-end'
|
64
|
+
},
|
65
|
+
rightLabel: {
|
66
|
+
color: '#737373',
|
67
|
+
right: '0px',
|
68
|
+
position: 'absolute',
|
69
|
+
fontSize: '11px',
|
70
|
+
alignSelf: 'flex-end'
|
71
|
+
},
|
72
|
+
textValue: {
|
73
|
+
position: 'absolute',
|
74
|
+
zIndex: '2'
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
/**
|
79
|
+
* HiSlider component
|
80
|
+
*/
|
81
|
+
class HiSlider extends React.Component {
|
82
|
+
|
83
|
+
constructor(props) {
|
84
|
+
super(props);
|
85
|
+
this.leftLabelWidth = 0;
|
86
|
+
this.rightLabelWidth = 0;
|
87
|
+
this.textValueWidth = 0;
|
88
|
+
this.barContainerWidth = 0;
|
89
|
+
|
90
|
+
this.handleFocus = isFocused => () => {
|
91
|
+
this.setState({ focused: isFocused });
|
92
|
+
};
|
93
|
+
|
94
|
+
this.state = {
|
95
|
+
focused: false
|
96
|
+
};
|
97
|
+
|
98
|
+
this.leftLabel;
|
99
|
+
this.rightLabel;
|
100
|
+
this.textValue;
|
101
|
+
this.barContainer;
|
102
|
+
|
103
|
+
this.handleChange = this.handleChange.bind(this);
|
104
|
+
this.handleFocus = this.handleFocus.bind(this);
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Measures several components once they are mounted.
|
109
|
+
* If the value and a label (left or right) are hovered,
|
110
|
+
* we hide this label.
|
111
|
+
*/
|
112
|
+
componentDidMount() {
|
113
|
+
this.leftLabelWidth = this.leftLabel.offsetWidth;
|
114
|
+
this.rightLabelWidth = this.rightLabel.offsetWidth;
|
115
|
+
this.textValueWidth = this.textValue.offsetWidth;
|
116
|
+
this.barContainerWidth = this.barContainer.offsetWidth;
|
117
|
+
let { hoveringLeft, hoveringRight } = this.getHovering();
|
118
|
+
if (hoveringLeft || hoveringRight) {
|
119
|
+
this.forceUpdate();
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
handleChange(event) {
|
124
|
+
this.props.onChange(parseFloat(event.target.value));
|
125
|
+
this.textValueWidth = this.textValue.offsetWidth;
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Calculates if the labels are hovered.
|
130
|
+
*/
|
131
|
+
getHovering() {
|
132
|
+
const ratio = (this.props.value - this.props.min) / (this.props.max - this.props.min);
|
133
|
+
const hoveringLeft = this.leftLabelWidth - (ratio * this.barContainerWidth - ratio * this.textValueWidth) > 0;
|
134
|
+
const hoveringRight = this.barContainerWidth - ratio * this.barContainerWidth - this.rightLabelWidth - (1 - ratio) * this.textValueWidth < 0;
|
135
|
+
return { hoveringLeft, hoveringRight };
|
136
|
+
}
|
137
|
+
|
138
|
+
render() {
|
139
|
+
const {
|
140
|
+
classes,
|
141
|
+
className,
|
142
|
+
min,
|
143
|
+
max,
|
144
|
+
leftLabel,
|
145
|
+
rightLabel,
|
146
|
+
step,
|
147
|
+
suffix,
|
148
|
+
id,
|
149
|
+
label,
|
150
|
+
theme,
|
151
|
+
value
|
152
|
+
} = this.props;
|
153
|
+
const { focused } = this.state;
|
154
|
+
const ratio = (value - min) / (max - min);
|
155
|
+
const percentage = ratio * 100;
|
156
|
+
const { hoveringLeft, hoveringRight } = this.getHovering();
|
157
|
+
const barColor = focused ? theme.palette.business.primary.dark : theme.palette.business.primary.normal;
|
158
|
+
return (
|
159
|
+
// HiFormControl pour l'affichage du label
|
160
|
+
React.createElement(
|
161
|
+
HiFormControl,
|
162
|
+
{
|
163
|
+
id: id,
|
164
|
+
label: label,
|
165
|
+
className: className,
|
166
|
+
onFocus: this.handleFocus(true),
|
167
|
+
onBlur: this.handleFocus(false)
|
168
|
+
},
|
169
|
+
React.createElement(
|
170
|
+
'div',
|
171
|
+
{ className: classes.mainContainer },
|
172
|
+
React.createElement(
|
173
|
+
'div',
|
174
|
+
null,
|
175
|
+
min,
|
176
|
+
suffix
|
177
|
+
),
|
178
|
+
React.createElement(
|
179
|
+
'div',
|
180
|
+
{ className: classes.barContainer, ref: div => this.barContainer = div },
|
181
|
+
React.createElement(
|
182
|
+
'div',
|
183
|
+
{ className: classes.topContainer },
|
184
|
+
!hoveringLeft && React.createElement(
|
185
|
+
'div',
|
186
|
+
{
|
187
|
+
className: classes.leftLabel,
|
188
|
+
ref: div => this.leftLabel = div
|
189
|
+
},
|
190
|
+
leftLabel
|
191
|
+
),
|
192
|
+
React.createElement(
|
193
|
+
'div',
|
194
|
+
{
|
195
|
+
className: classes.textValue,
|
196
|
+
style: {
|
197
|
+
left: `${percentage}%`,
|
198
|
+
transform: `translate(-${percentage}%)`
|
199
|
+
},
|
200
|
+
ref: div => this.textValue = div
|
201
|
+
},
|
202
|
+
value,
|
203
|
+
suffix
|
204
|
+
),
|
205
|
+
!hoveringRight && React.createElement(
|
206
|
+
'div',
|
207
|
+
{
|
208
|
+
className: classes.rightLabel,
|
209
|
+
ref: div => this.rightLabel = div
|
210
|
+
},
|
211
|
+
rightLabel
|
212
|
+
)
|
213
|
+
),
|
214
|
+
React.createElement('div', {
|
215
|
+
className: classes.barValue,
|
216
|
+
style: {
|
217
|
+
background: `linear-gradient(to right, ${barColor}, ${barColor} ${percentage}%, #E0E0E0 ${percentage}%, #E0E0E0)`
|
218
|
+
}
|
219
|
+
}),
|
220
|
+
React.createElement('input', {
|
221
|
+
type: 'range',
|
222
|
+
min: min,
|
223
|
+
max: max,
|
224
|
+
value: value,
|
225
|
+
onChange: this.handleChange,
|
226
|
+
className: classes.barHidden,
|
227
|
+
step: step
|
228
|
+
}),
|
229
|
+
React.createElement(
|
230
|
+
'div',
|
231
|
+
{ className: classes.bottomContainer },
|
232
|
+
React.createElement(HiIconBuilder, {
|
233
|
+
className: classNames(classes.arrow, {
|
234
|
+
[classes.focused]: focused
|
235
|
+
}),
|
236
|
+
icon: 'menu_up',
|
237
|
+
size: 24,
|
238
|
+
style: { left: `${percentage}%` }
|
239
|
+
})
|
240
|
+
)
|
241
|
+
),
|
242
|
+
React.createElement(
|
243
|
+
'div',
|
244
|
+
null,
|
245
|
+
max,
|
246
|
+
suffix
|
247
|
+
)
|
248
|
+
)
|
249
|
+
)
|
250
|
+
);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
HiSlider.propTypes = process.env.NODE_ENV !== "production" ? {
|
255
|
+
/**
|
256
|
+
* Useful to extend the style applied to components.
|
257
|
+
*/
|
258
|
+
classes: PropTypes.object,
|
259
|
+
/**
|
260
|
+
* Classes CSS appliquées.
|
261
|
+
*/
|
262
|
+
className: PropTypes.string,
|
263
|
+
/**
|
264
|
+
* Id de l'élément input
|
265
|
+
*/
|
266
|
+
id: PropTypes.string.isRequired,
|
267
|
+
/**
|
268
|
+
* Label du champ
|
269
|
+
*/
|
270
|
+
label: PropTypes.string,
|
271
|
+
/**
|
272
|
+
* The label to show on the left.
|
273
|
+
*/
|
274
|
+
leftLabel: PropTypes.string,
|
275
|
+
/**
|
276
|
+
* The Maximum value for the slider.
|
277
|
+
*/
|
278
|
+
max: PropTypes.number.isRequired,
|
279
|
+
/**
|
280
|
+
* The Minimum value for the slider.
|
281
|
+
*/
|
282
|
+
min: PropTypes.number.isRequired,
|
283
|
+
/**
|
284
|
+
* Fonction de callback appelée lorsqu'on change la valeur du slider.
|
285
|
+
*/
|
286
|
+
onChange: PropTypes.func,
|
287
|
+
/**
|
288
|
+
* The label to show on the right
|
289
|
+
*/
|
290
|
+
rightLabel: PropTypes.string,
|
291
|
+
/**
|
292
|
+
* The step between two selectable values.
|
293
|
+
*/
|
294
|
+
step: PropTypes.number,
|
295
|
+
/**
|
296
|
+
* The suffix to show after each number.
|
297
|
+
*/
|
298
|
+
suffix: PropTypes.string,
|
299
|
+
/**
|
300
|
+
* @ignore
|
301
|
+
*/
|
302
|
+
theme: PropTypes.object,
|
303
|
+
/**
|
304
|
+
* The
|
305
|
+
* value of the input.
|
306
|
+
*/
|
307
|
+
value: PropTypes.number
|
308
|
+
} : {};
|
309
|
+
export default withStyles(styles, { name: 'HmuiHiSlider', withTheme: true })(HiSlider);
|
package/es/HiForm/index.js
CHANGED
@@ -5,4 +5,5 @@ export { default as HiInput } from './HiInput';
|
|
5
5
|
export { default as HiPasswordField } from './HiPasswordField';
|
6
6
|
export { default as HiTextField } from './HiTextField';
|
7
7
|
export { default as HiSearchField } from './HiSearchField';
|
8
|
+
export { default as HiSlider } from './HiSlider';
|
8
9
|
export { default as HiAddressField } from './HiAddressField';
|
@@ -155,6 +155,7 @@ export default class BodyCellBuilder extends React.PureComponent {
|
|
155
155
|
cellElement = React.createElement(CellIcon, {
|
156
156
|
value: data.label ? data.label : data.value,
|
157
157
|
icon: data.icon,
|
158
|
+
color: data.color,
|
158
159
|
view: view,
|
159
160
|
sticky: sticky
|
160
161
|
});
|
@@ -164,6 +165,7 @@ export default class BodyCellBuilder extends React.PureComponent {
|
|
164
165
|
cellElement = React.createElement(CellImage, {
|
165
166
|
value: data.label ? data.label : data.value,
|
166
167
|
path: data.img,
|
168
|
+
size: this.props.size,
|
167
169
|
view: view,
|
168
170
|
sticky: sticky
|
169
171
|
});
|
@@ -173,6 +175,7 @@ export default class BodyCellBuilder extends React.PureComponent {
|
|
173
175
|
cellElement = React.createElement(CellNumeric, {
|
174
176
|
value: data.value,
|
175
177
|
currency: data.currency,
|
178
|
+
precision: data.precision,
|
176
179
|
locale: numberLocale,
|
177
180
|
view: view,
|
178
181
|
sticky: sticky
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
|
4
3
|
import Tooltip from '../../Tooltip';
|
5
4
|
import withStyles from '../../styles/withStyles';
|
6
5
|
import * as cst from '../constants';
|
7
6
|
import HiIconBuilder from '../../utils/HiIconBuilder';
|
8
7
|
|
9
|
-
export const styles =
|
8
|
+
export const styles = {
|
10
9
|
icon: {
|
11
10
|
float: 'left'
|
12
11
|
},
|
@@ -17,8 +16,11 @@ export const styles = theme => ({
|
|
17
16
|
whiteSpace: 'nowrap',
|
18
17
|
overflow: 'hidden',
|
19
18
|
textOverflow: 'ellipsis'
|
19
|
+
},
|
20
|
+
nowrap: {
|
21
|
+
whiteSpace: 'nowrap'
|
20
22
|
}
|
21
|
-
}
|
23
|
+
};
|
22
24
|
|
23
25
|
/**
|
24
26
|
* Cette cellule permet d'afficher une icône et un label (optionnel).
|
@@ -27,13 +29,13 @@ export const styles = theme => ({
|
|
27
29
|
class CellIcon extends React.PureComponent {
|
28
30
|
|
29
31
|
render() {
|
30
|
-
const { classes, icon, value, view } = this.props;
|
32
|
+
const { classes, icon, value, view, color } = this.props;
|
31
33
|
|
32
|
-
const iconElement = icon !== '' ? React.createElement(HiIconBuilder, { className: classes.icon, icon: icon, size: 18 }) : '';
|
34
|
+
const iconElement = icon !== '' ? React.createElement(HiIconBuilder, { color: color, className: classes.icon, icon: icon, size: 18 }) : '';
|
33
35
|
|
34
36
|
const tooltipContent = React.createElement(
|
35
37
|
'div',
|
36
|
-
|
38
|
+
{ className: classes.nowrap },
|
37
39
|
iconElement,
|
38
40
|
React.createElement(
|
39
41
|
'span',
|
@@ -61,7 +63,8 @@ class CellIcon extends React.PureComponent {
|
|
61
63
|
|
62
64
|
CellIcon.defaultProps = {
|
63
65
|
icon: '',
|
64
|
-
view: 'l'
|
66
|
+
view: 'l',
|
67
|
+
color: '#000'
|
65
68
|
};
|
66
69
|
CellIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
67
70
|
/**
|
@@ -69,7 +72,11 @@ CellIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
69
72
|
*/
|
70
73
|
classes: PropTypes.object,
|
71
74
|
/**
|
72
|
-
*
|
75
|
+
* Couleur de l'icône
|
76
|
+
*/
|
77
|
+
color: PropTypes.string.isRequired,
|
78
|
+
/**
|
79
|
+
* Icon name [from material-design-icons](https://materialdesignicons.com/)
|
73
80
|
* used by HiIconBuilder
|
74
81
|
*/
|
75
82
|
icon: PropTypes.string,
|
@@ -1,18 +1,15 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
|
4
3
|
import Tooltip from '../../Tooltip';
|
5
4
|
import withStyles from '../../styles/withStyles';
|
6
5
|
import * as cst from '../constants';
|
7
6
|
|
8
7
|
export const styles = theme => ({
|
9
8
|
img: {
|
10
|
-
width: 24,
|
11
9
|
height: 'auto',
|
12
10
|
float: 'left'
|
13
11
|
},
|
14
12
|
smallImg: {
|
15
|
-
width: 24,
|
16
13
|
height: 'auto'
|
17
14
|
},
|
18
15
|
label: {
|
@@ -21,20 +18,18 @@ export const styles = theme => ({
|
|
21
18
|
tooltipImg: {
|
22
19
|
width: 24,
|
23
20
|
height: 'auto',
|
24
|
-
float: 'left'
|
25
|
-
marginTop: 2
|
21
|
+
float: 'left'
|
26
22
|
},
|
27
23
|
tooltipLabel: {
|
28
24
|
marginLeft: 5,
|
29
|
-
position: 'relative',
|
30
|
-
bottom: 2,
|
31
25
|
verticalAlign: 'middle'
|
32
|
-
|
33
26
|
},
|
34
27
|
wrapper: {
|
28
|
+
display: 'flex',
|
29
|
+
alignItems: 'center',
|
35
30
|
whiteSpace: 'nowrap',
|
36
|
-
overflow:
|
37
|
-
textOverflow:
|
31
|
+
overflow: 'hidden',
|
32
|
+
textOverflow: 'ellipsis'
|
38
33
|
},
|
39
34
|
center: {
|
40
35
|
textAlign: 'center'
|
@@ -53,12 +48,12 @@ export const styles = theme => ({
|
|
53
48
|
class CellImage extends React.PureComponent {
|
54
49
|
|
55
50
|
render() {
|
56
|
-
const { classes, path, value, view } = this.props;
|
51
|
+
const { classes, path, value, view, size } = this.props;
|
57
52
|
|
58
53
|
const tooltipContent = React.createElement(
|
59
54
|
'div',
|
60
55
|
{ className: classes.tooltipContainer },
|
61
|
-
React.createElement('img', { src: path, alt: value, className: classes.tooltipImg }),
|
56
|
+
React.createElement('img', { src: path, alt: value, className: classes.tooltipImg, width: size }),
|
62
57
|
React.createElement(
|
63
58
|
'span',
|
64
59
|
{ className: classes.tooltipLabel },
|
@@ -72,13 +67,13 @@ class CellImage extends React.PureComponent {
|
|
72
67
|
innerCellElement = React.createElement(
|
73
68
|
'div',
|
74
69
|
{ className: classes.center },
|
75
|
-
React.createElement('img', { src: path, alt: value, className: classes.smallImg })
|
70
|
+
React.createElement('img', { src: path, alt: value, className: classes.smallImg, width: size })
|
76
71
|
);
|
77
72
|
} else {
|
78
73
|
innerCellElement = React.createElement(
|
79
74
|
'div',
|
80
75
|
{ className: classes.wrapper },
|
81
|
-
React.createElement('img', { src: path, alt: value, className: classes.img }),
|
76
|
+
React.createElement('img', { src: path, alt: value, className: classes.img, width: size }),
|
82
77
|
!!value && React.createElement(
|
83
78
|
'span',
|
84
79
|
{ className: classes.label },
|
@@ -111,6 +106,9 @@ class CellImage extends React.PureComponent {
|
|
111
106
|
}
|
112
107
|
}
|
113
108
|
|
109
|
+
CellImage.defaultProps = {
|
110
|
+
size: 24
|
111
|
+
};
|
114
112
|
CellImage.propTypes = process.env.NODE_ENV !== "production" ? {
|
115
113
|
/**
|
116
114
|
* Useful to extend the style applied to components.
|
@@ -120,6 +118,10 @@ CellImage.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
120
118
|
* Image path
|
121
119
|
*/
|
122
120
|
path: PropTypes.string,
|
121
|
+
/**
|
122
|
+
* Image path
|
123
|
+
*/
|
124
|
+
size: PropTypes.number.isRequired,
|
123
125
|
/**
|
124
126
|
* Value
|
125
127
|
*/
|
@@ -18,7 +18,7 @@ export const styles = theme => ({
|
|
18
18
|
class CellNumeric extends React.PureComponent {
|
19
19
|
|
20
20
|
render() {
|
21
|
-
const { classes, value, locale, currency, view } = this.props;
|
21
|
+
const { classes, value, locale, currency, view, precision } = this.props;
|
22
22
|
|
23
23
|
let displayedValue = '';
|
24
24
|
let titleValue = '';
|
@@ -31,7 +31,7 @@ class CellNumeric extends React.PureComponent {
|
|
31
31
|
titleValue = formatCurrencyAmount(value, cst.VIEWS.LARGE, locale, currency);
|
32
32
|
}
|
33
33
|
} else {
|
34
|
-
displayedValue = formatNumber(value, view, locale);
|
34
|
+
displayedValue = formatNumber(value, view, locale, precision);
|
35
35
|
}
|
36
36
|
|
37
37
|
return React.createElement(
|
@@ -63,6 +63,10 @@ CellNumeric.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
63
63
|
* Code de la devise (ISO 4217)
|
64
64
|
*/
|
65
65
|
currency: PropTypes.string,
|
66
|
+
/**
|
67
|
+
* Nombre de chiffres après la virgule
|
68
|
+
*/
|
69
|
+
precision: PropTypes.number,
|
66
70
|
/**
|
67
71
|
* View (L/M/S)
|
68
72
|
*/
|
@@ -5,15 +5,18 @@ import HiColoredLabel from '../../HiColoredLabel';
|
|
5
5
|
import { withStyles } from '../../styles';
|
6
6
|
import * as cst from '../constants';
|
7
7
|
|
8
|
-
export const styles =
|
8
|
+
export const styles = {
|
9
9
|
smartDecision: {
|
10
10
|
display: 'inline-block',
|
11
11
|
minWidth: 18
|
12
12
|
},
|
13
13
|
label: {
|
14
14
|
marginLeft: 2
|
15
|
+
},
|
16
|
+
nowrap: {
|
17
|
+
whiteSpace: 'nowrap'
|
15
18
|
}
|
16
|
-
}
|
19
|
+
};
|
17
20
|
|
18
21
|
/**
|
19
22
|
* Cette cellule permet d'afficher le résultat de Sentinel (score & fraudResult & smartDecision)
|
@@ -77,17 +80,17 @@ class CellSentinel extends React.PureComponent {
|
|
77
80
|
null,
|
78
81
|
React.createElement(
|
79
82
|
'div',
|
80
|
-
|
83
|
+
{ className: classes.nowrap },
|
81
84
|
scoreLabel
|
82
85
|
),
|
83
86
|
React.createElement(
|
84
87
|
'div',
|
85
|
-
|
88
|
+
{ className: classes.nowrap },
|
86
89
|
fraudResult
|
87
90
|
),
|
88
91
|
!!smartDecision && automaticFraudReviewResult && React.createElement(
|
89
92
|
'div',
|
90
|
-
|
93
|
+
{ className: classes.nowrap },
|
91
94
|
'SD: ',
|
92
95
|
automaticFraudReviewResult
|
93
96
|
)
|
@@ -2,17 +2,19 @@
|
|
2
2
|
|
3
3
|
import React from 'react';
|
4
4
|
import PropTypes from 'prop-types';
|
5
|
-
|
6
|
-
import Tooltip from '../../Tooltip';
|
7
|
-
import { withStyles, withTheme } from '../../styles';
|
8
5
|
import { Lock, LockOpen, LockOpenOutline } from 'mdi-material-ui';
|
6
|
+
import Tooltip from '../../Tooltip';
|
7
|
+
import { withStyles } from '../../styles';
|
9
8
|
|
10
|
-
export const styles =
|
9
|
+
export const styles = {
|
11
10
|
icon: {
|
12
11
|
width: 18,
|
13
12
|
height: 18
|
13
|
+
},
|
14
|
+
nowrap: {
|
15
|
+
whiteSpace: 'nowrap'
|
14
16
|
}
|
15
|
-
}
|
17
|
+
};
|
16
18
|
|
17
19
|
/**
|
18
20
|
* Cette cellule permet d'afficher une icône représentant le statut du 3DS.
|
@@ -31,26 +33,45 @@ class CellThirdPartySecurity extends React.PureComponent {
|
|
31
33
|
let icon = null;
|
32
34
|
switch (value) {
|
33
35
|
case ECI_5:
|
34
|
-
icon = React.createElement(Lock, {
|
36
|
+
icon = React.createElement(Lock, {
|
37
|
+
className: classes.icon,
|
38
|
+
style: { color: theme.palette.positive.normal }
|
39
|
+
});
|
35
40
|
break;
|
36
41
|
case ECI_6:
|
37
|
-
icon = React.createElement(LockOpen, {
|
42
|
+
icon = React.createElement(LockOpen, {
|
43
|
+
className: classes.icon,
|
44
|
+
style: { color: theme.palette.middle.normal }
|
45
|
+
});
|
38
46
|
break;
|
39
47
|
case AUTH_1:
|
40
|
-
icon = React.createElement(LockOpenOutline, {
|
48
|
+
icon = React.createElement(LockOpenOutline, {
|
49
|
+
className: classes.icon,
|
50
|
+
style: { color: theme.palette.neutral.light }
|
51
|
+
});
|
41
52
|
break;
|
42
53
|
case AUTH_2:
|
43
|
-
icon = React.createElement(LockOpen, {
|
54
|
+
icon = React.createElement(LockOpen, {
|
55
|
+
className: classes.icon,
|
56
|
+
style: { color: theme.palette.neutral.light }
|
57
|
+
});
|
44
58
|
break;
|
45
59
|
case ECI_7:
|
46
60
|
case AUTH_0:
|
61
|
+
default:
|
47
62
|
icon = null;
|
48
63
|
break;
|
49
64
|
}
|
50
65
|
|
66
|
+
const tooltipContent = React.createElement(
|
67
|
+
'div',
|
68
|
+
{ className: classes.nowrap },
|
69
|
+
label
|
70
|
+
);
|
71
|
+
|
51
72
|
return React.createElement(
|
52
73
|
Tooltip,
|
53
|
-
{ title:
|
74
|
+
{ title: tooltipContent, placement: this.props.sticky ? 'right' : 'bottom' },
|
54
75
|
React.createElement(
|
55
76
|
'div',
|
56
77
|
null,
|
@@ -65,6 +86,14 @@ CellThirdPartySecurity.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
65
86
|
* Useful to extend the style applied to components.
|
66
87
|
*/
|
67
88
|
classes: PropTypes.object,
|
89
|
+
/**
|
90
|
+
* Label
|
91
|
+
*/
|
92
|
+
label: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
93
|
+
/**
|
94
|
+
* True si la colonne est sticky
|
95
|
+
*/
|
96
|
+
sticky: PropTypes.bool,
|
68
97
|
/**
|
69
98
|
* Useful to extend the theme applied to components.
|
70
99
|
* Used theme props positive.normal, middle.normal, neutral.light
|
@@ -79,10 +108,6 @@ CellThirdPartySecurity.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
79
108
|
* AUTH_1 = 4; // ask for 3DS
|
80
109
|
* AUTH_2 = 5; // force 3DS
|
81
110
|
*/
|
82
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
83
|
-
/**
|
84
|
-
* Label
|
85
|
-
*/
|
86
|
-
label: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
111
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
87
112
|
} : {};
|
88
113
|
export default withStyles(styles, { withTheme: true, name: 'HmuiCellThirdPartySecurity' })(CellThirdPartySecurity);
|