@hipay/hipay-material-ui 2.0.0-beta.54 → 2.0.0-beta.56
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +57 -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 +28 -4
- package/HiCell/CellNumeric.js +1 -2
- package/HiCell/CellRate.js +6 -3
- package/HiCell/CellSentinel.js +7 -10
- package/HiCell/CellSentinelScore.js +4 -4
- package/HiCell/CellTextStyled.js +99 -0
- package/HiCell/index.js +9 -1
- package/HiChip/HiChip.js +1 -0
- package/HiDatePicker/Caption.js +8 -9
- package/HiDatePicker/HiDateRangePicker.js +37 -19
- package/HiDatePicker/HiDateRangeSelector.js +24 -22
- package/HiDatePicker/Overlays/CustomOverlayLayout.js +26 -17
- 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 +2 -4
- package/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/HiDatePicker/stylesheet.js +3 -2
- 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/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 +93 -0
- package/HiNotice/index.js +23 -0
- package/HiPdfReader/HiPdfReader.js +269 -0
- package/HiPdfReader/index.js +15 -0
- package/HiRadio/HiRadio.js +74 -0
- package/HiRadio/index.js +15 -0
- package/HiSelect/HiSelect.js +73 -84
- package/HiSelect/HiSuggestSelect.js +32 -5
- package/HiSelect/SelectInput.js +5 -0
- package/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/HiSelectNew/HiSelect.js +174 -137
- package/HiSelectNew/HiSelectContent.js +0 -8
- package/HiSelectNew/HiSelectInput.js +8 -9
- package/HiSelectableList/HiSelectableList.js +32 -4
- package/HiSelectableList/HiSelectableListItem.js +62 -24
- package/HiTable/HiCellBuilder.js +42 -32
- package/HiTable/HiTableHeader.js +28 -21
- package/HiTable/constants.js +3 -1
- package/README.md +249 -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 +25 -2
- package/es/HiCell/CellNumeric.js +1 -2
- package/es/HiCell/CellRate.js +6 -3
- package/es/HiCell/CellSentinel.js +7 -10
- package/es/HiCell/CellSentinelScore.js +4 -4
- package/es/HiCell/CellTextStyled.js +84 -0
- package/es/HiCell/index.js +2 -1
- package/es/HiChip/HiChip.js +1 -0
- package/es/HiDatePicker/Caption.js +7 -9
- package/es/HiDatePicker/HiDateRangePicker.js +41 -25
- package/es/HiDatePicker/HiDateRangeSelector.js +24 -22
- package/es/HiDatePicker/ListPicker.js +1 -1
- package/es/HiDatePicker/Overlays/CustomOverlayLayout.js +30 -19
- package/es/HiDatePicker/Overlays/MonthPickerOverlay.js +2 -2
- 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 +2 -4
- package/es/HiDatePicker/Overlays/YearPickerOverlay.spec.js +1 -0
- package/es/HiDatePicker/stylesheet.js +3 -2
- 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/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 +77 -0
- package/es/HiNotice/index.js +2 -0
- package/es/HiPdfReader/HiPdfReader.js +214 -0
- package/es/HiPdfReader/index.js +1 -0
- 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 +27 -6
- package/es/HiSelect/SelectInput.js +5 -0
- package/es/HiSelectNew/HiNestedSelectContent.js +5 -1
- package/es/HiSelectNew/HiSelect.js +156 -120
- package/es/HiSelectNew/HiSelectContent.js +0 -7
- package/es/HiSelectNew/HiSelectInput.js +8 -9
- package/es/HiSelectableList/HiSelectableList.js +28 -6
- package/es/HiSelectableList/HiSelectableListItem.js +71 -24
- package/es/HiTable/HiCellBuilder.js +140 -136
- package/es/HiTable/HiTableHeader.js +26 -18
- package/es/HiTable/constants.js +1 -0
- package/es/index.js +7 -0
- package/es/utils/helpers.js +1 -1
- package/index.es.js +8 -1
- package/index.js +57 -1
- package/package.json +6 -3
- package/umd/hipay-material-ui.development.js +42114 -35120
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/utils/helpers.js +1 -1
@@ -162,14 +162,12 @@ class HiSelectInput extends React.PureComponent {
|
|
162
162
|
this.handleBlur = event => {
|
163
163
|
if ((!this.input || !this.input.contains(event.relatedTarget)) && this.props.onBlur) {
|
164
164
|
this.props.onBlur(event);
|
165
|
-
} else {
|
166
|
-
|
167
|
-
this.input.focus();
|
168
|
-
}
|
165
|
+
} else if (this.input && (!this.resetIcon || !this.resetIcon.contains(event.relatedTarget))) {
|
166
|
+
this.input.focus();
|
169
167
|
}
|
170
168
|
};
|
171
169
|
|
172
|
-
this.
|
170
|
+
this.ref = el => {
|
173
171
|
this.input = el;
|
174
172
|
|
175
173
|
if (this.props.refElement) {
|
@@ -180,7 +178,7 @@ class HiSelectInput extends React.PureComponent {
|
|
180
178
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
181
179
|
this.handleClick = this.handleClick.bind(this);
|
182
180
|
this.handleBlur = this.handleBlur.bind(this);
|
183
|
-
this.
|
181
|
+
this.ref = this.ref.bind(this);
|
184
182
|
this.handleReset = this.handleReset.bind(this);
|
185
183
|
}
|
186
184
|
|
@@ -219,7 +217,7 @@ class HiSelectInput extends React.PureComponent {
|
|
219
217
|
onBlur: this.props.onBlur,
|
220
218
|
role: "button",
|
221
219
|
tabIndex: "0",
|
222
|
-
ref: this.
|
220
|
+
ref: this.ref
|
223
221
|
}, React.createElement("span", {
|
224
222
|
className: classNames(classes.label, {
|
225
223
|
[classes.placeholder]: value === undefined
|
@@ -235,8 +233,9 @@ class HiSelectInput extends React.PureComponent {
|
|
235
233
|
onMouseLeave: this.props.onMouseLeave,
|
236
234
|
onKeyDown: this.handleKeyDown,
|
237
235
|
onFocus: this.props.onFocus,
|
238
|
-
onBlur: this.handleBlur
|
239
|
-
|
236
|
+
onBlur: this.handleBlur // buttref={this.ref}
|
237
|
+
,
|
238
|
+
buttonRef: this.ref
|
240
239
|
}, React.createElement("span", {
|
241
240
|
className: classNames(classes.label, {
|
242
241
|
[classes.placeholder]: value === undefined
|
@@ -5,7 +5,8 @@ import PropTypes from 'prop-types';
|
|
5
5
|
import List from '@material-ui/core/List';
|
6
6
|
import withStyles from '../styles/withStyles';
|
7
7
|
import HiSelectableListItem from './HiSelectableListItem';
|
8
|
-
import { foldAccents } from '../utils/helpers';
|
8
|
+
import { foldAccents, getNextItemSelectable } from '../utils/helpers';
|
9
|
+
import keycode from 'keycode';
|
9
10
|
export const styles = () => ({
|
10
11
|
root: {
|
11
12
|
padding: 0
|
@@ -23,6 +24,27 @@ class HiSelectableList extends React.PureComponent {
|
|
23
24
|
this.props.onSelect(event, item);
|
24
25
|
};
|
25
26
|
|
27
|
+
this.handleKeyDown = event => {
|
28
|
+
let nextItem;
|
29
|
+
const key = keycode(event);
|
30
|
+
|
31
|
+
if (key === 'down') {
|
32
|
+
event.preventDefault();
|
33
|
+
nextItem = getNextItemSelectable(document.activeElement, 'down');
|
34
|
+
} else if (key === 'up') {
|
35
|
+
event.preventDefault();
|
36
|
+
nextItem = getNextItemSelectable(document.activeElement, 'up');
|
37
|
+
} else if (key === 'space' || key === 'enter' && !this.props.multiple) {
|
38
|
+
event.preventDefault();
|
39
|
+
const item = this.props.options.find(elem => String(elem.id) === event.target.id);
|
40
|
+
this.handleSelect(null, item);
|
41
|
+
}
|
42
|
+
|
43
|
+
if (nextItem) {
|
44
|
+
nextItem.focus();
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
26
48
|
this.buildRecursiveListItem = (item, level = 0) => {
|
27
49
|
const _this$props = this.props,
|
28
50
|
{
|
@@ -33,9 +55,10 @@ class HiSelectableList extends React.PureComponent {
|
|
33
55
|
hoverIcon,
|
34
56
|
icon,
|
35
57
|
selectedItemIdList,
|
36
|
-
sort
|
58
|
+
sort,
|
59
|
+
onKeyDown = this.handleKeyDown
|
37
60
|
} = _this$props,
|
38
|
-
others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort"]);
|
61
|
+
others = _objectWithoutProperties(_this$props, ["checkedIcon", "disabled", "disabledItemIdList", "hideCheckbox", "hoverIcon", "icon", "selectedItemIdList", "sort", "onKeyDown"]);
|
39
62
|
|
40
63
|
if (sort && item.children) {
|
41
64
|
item.children.sort(this.compareItem);
|
@@ -51,6 +74,7 @@ class HiSelectableList extends React.PureComponent {
|
|
51
74
|
icon: icon,
|
52
75
|
level: level,
|
53
76
|
onSelect: this.handleSelect(item),
|
77
|
+
onKeyDown: onKeyDown,
|
54
78
|
selected: selectedItemIdList.includes(item.id) // item props override upper props (disabled, hideCheckbox, icon, level...)
|
55
79
|
|
56
80
|
}, item)), item.children && item.children.length > 0 && item.children.filter(subItem => !(subItem.displayed === false)).map(subItem => this.buildRecursiveListItem(subItem, level + 1)));
|
@@ -79,7 +103,6 @@ class HiSelectableList extends React.PureComponent {
|
|
79
103
|
const {
|
80
104
|
classes,
|
81
105
|
itemList,
|
82
|
-
onKeyDown,
|
83
106
|
sort
|
84
107
|
} = this.props;
|
85
108
|
|
@@ -88,8 +111,7 @@ class HiSelectableList extends React.PureComponent {
|
|
88
111
|
}
|
89
112
|
|
90
113
|
return React.createElement(List, {
|
91
|
-
className: classes.root
|
92
|
-
onKeyDown: onKeyDown
|
114
|
+
className: classes.root
|
93
115
|
}, itemList.filter(item => !(item.displayed === false)) // don't remove if undefined
|
94
116
|
.map(item => this.buildRecursiveListItem(item)));
|
95
117
|
}
|
@@ -21,15 +21,20 @@ export const styles = theme => ({
|
|
21
21
|
listItem: {
|
22
22
|
backgroundColor: theme.palette.background3,
|
23
23
|
color: theme.palette.neutral.dark,
|
24
|
-
padding: '5px
|
24
|
+
padding: '5px 12px 5px 0px',
|
25
25
|
fontWeight: theme.typography.fontWeightRegular,
|
26
26
|
maxHeight: 56,
|
27
27
|
display: 'inline-flex',
|
28
28
|
alignItems: 'center',
|
29
29
|
cursor: 'pointer',
|
30
|
+
'&$listItemInlineWithInfoWithoutSecondary': {
|
31
|
+
justifyContent: 'space-between'
|
32
|
+
},
|
33
|
+
'&$listItemWithoutSecondaryInline': {
|
34
|
+
display: 'block'
|
35
|
+
},
|
30
36
|
'&$inline': {
|
31
37
|
maxHeight: 40,
|
32
|
-
alignItems: 'flex-start',
|
33
38
|
'& $secondaryLabel': {
|
34
39
|
display: 'inline-block'
|
35
40
|
}
|
@@ -39,6 +44,8 @@ export const styles = theme => ({
|
|
39
44
|
outline: 'none'
|
40
45
|
}
|
41
46
|
},
|
47
|
+
listItemWithoutSecondaryInline: {},
|
48
|
+
listItemInlineWithInfoWithoutSecondary: {},
|
42
49
|
listItemHover: {
|
43
50
|
'&:hover:not($disabled):not($pinned)': {
|
44
51
|
backgroundColor: theme.palette.action.hover,
|
@@ -81,10 +88,15 @@ export const styles = theme => ({
|
|
81
88
|
width: '100%',
|
82
89
|
minWidth: '50%',
|
83
90
|
padding: '5px 0',
|
91
|
+
'&$listItemContentSelected': {
|
92
|
+
marginBottom: -3,
|
93
|
+
marginLeft: -4
|
94
|
+
},
|
84
95
|
'& strong': {
|
85
96
|
fontWeight: theme.typography.fontWeightMedium
|
86
97
|
}
|
87
98
|
}),
|
99
|
+
listItemContentSelected: {},
|
88
100
|
label: {
|
89
101
|
display: 'inline-block',
|
90
102
|
margin: '1px 0',
|
@@ -108,15 +120,9 @@ export const styles = theme => ({
|
|
108
120
|
fontSize: 12,
|
109
121
|
textOverflow: 'ellipsis',
|
110
122
|
textAlign: 'right',
|
111
|
-
|
123
|
+
padding: '4px 0px 4px 8px',
|
112
124
|
alignSelf: 'center'
|
113
125
|
}),
|
114
|
-
checkbox: {
|
115
|
-
marginTop: 3
|
116
|
-
},
|
117
|
-
checkboxWithSecondaryInline: {
|
118
|
-
marginTop: '-8px'
|
119
|
-
},
|
120
126
|
img: {
|
121
127
|
width: 24,
|
122
128
|
height: 'auto',
|
@@ -126,7 +132,34 @@ export const styles = theme => ({
|
|
126
132
|
icon: {
|
127
133
|
margin: '0 4px',
|
128
134
|
verticalAlign: 'middle'
|
129
|
-
}
|
135
|
+
},
|
136
|
+
labelContent: {
|
137
|
+
display: 'flex',
|
138
|
+
alignItems: 'center',
|
139
|
+
maxWidth: '70%',
|
140
|
+
'&$labelWithoutSecondaryInline': {
|
141
|
+
maxWidth: '100%'
|
142
|
+
}
|
143
|
+
},
|
144
|
+
labelWithoutSecondaryInline: {},
|
145
|
+
infosContent: {
|
146
|
+
display: 'flex',
|
147
|
+
alignItems: 'center',
|
148
|
+
width: '100%',
|
149
|
+
justifyContent: 'space-between',
|
150
|
+
'&$infosInlineWithoutSecondary': {
|
151
|
+
width: 'auto'
|
152
|
+
},
|
153
|
+
'&$infosWithoutSecondaryInline': {
|
154
|
+
paddingLeft: 28
|
155
|
+
},
|
156
|
+
'&$infosWithSecondaryInline': {
|
157
|
+
marginTop: -8
|
158
|
+
}
|
159
|
+
},
|
160
|
+
infosInlineWithoutSecondary: {},
|
161
|
+
infosWithSecondaryInline: {},
|
162
|
+
infosWithoutSecondaryInline: {}
|
130
163
|
});
|
131
164
|
/**
|
132
165
|
* Construit un élément de liste sélectionnable (avec checkbox)
|
@@ -220,7 +253,8 @@ class HiSelectableListItem extends React.PureComponent {
|
|
220
253
|
secondaryInline,
|
221
254
|
secondaryLabel,
|
222
255
|
thin,
|
223
|
-
type
|
256
|
+
type,
|
257
|
+
color
|
224
258
|
} = this.props; // Return simple loader list item
|
225
259
|
|
226
260
|
if (type === 'loader') {
|
@@ -252,26 +286,32 @@ class HiSelectableListItem extends React.PureComponent {
|
|
252
286
|
[classes.selected]: selected,
|
253
287
|
[classes.thin]: thin,
|
254
288
|
[classes.pinned]: pinned,
|
255
|
-
[classes.inline]: secondaryInline
|
289
|
+
[classes.inline]: secondaryInline,
|
290
|
+
[classes.listItemWithoutSecondaryInline]: !secondaryInline,
|
291
|
+
[classes.listItemInlineWithInfoWithoutSecondary]: secondaryInline && info && !secondaryLabel
|
256
292
|
}),
|
257
293
|
disabled: disabled
|
258
294
|
}, disabled || {
|
259
295
|
onClick: onSelect,
|
260
296
|
onMouseEnter: this.setHover(true),
|
261
297
|
onMouseLeave: this.setHover(false),
|
262
|
-
onKeyDown
|
298
|
+
onKeyDown
|
263
299
|
}, {
|
264
300
|
style: {
|
265
301
|
paddingLeft: `${paddingLeft + level * 32}px`
|
266
302
|
}
|
267
|
-
}),
|
303
|
+
}), React.createElement("div", {
|
304
|
+
className: classNames(classes.labelContent, {
|
305
|
+
[classes.labelWithoutSecondaryInline]: !secondaryInline || !secondaryLabel && !info
|
306
|
+
})
|
307
|
+
}, !hideCheckbox && !pinned && React.createElement(HiCheckbox, {
|
268
308
|
tabIndex: onKeyDown ? '-1' : 0,
|
269
|
-
checked: selected,
|
270
|
-
checkedIcon: checkedIcon,
|
271
309
|
classes: {
|
272
310
|
root: !secondaryInline ? classes.checkboxWithSecondaryInline : classes.checkbox
|
273
311
|
},
|
274
|
-
|
312
|
+
checked: selected,
|
313
|
+
checkedIcon: checkedIcon,
|
314
|
+
color: disabled ? 'inherit' : 'primary',
|
275
315
|
disabled: disabled,
|
276
316
|
icon: displayedIcon,
|
277
317
|
indeterminate: indeterminate,
|
@@ -279,7 +319,8 @@ class HiSelectableListItem extends React.PureComponent {
|
|
279
319
|
}), React.createElement("div", {
|
280
320
|
className: classNames(classes.listItemContent, {
|
281
321
|
[classes.centered]: centered,
|
282
|
-
[classes.primaryHighlight]: type === 'primary-highlight'
|
322
|
+
[classes.primaryHighlight]: type === 'primary-highlight',
|
323
|
+
[classes.listItemContentSelected]: selected && color
|
283
324
|
}),
|
284
325
|
"data-id": id
|
285
326
|
}, type === 'icon' && icon && hideCheckbox && React.createElement(HiIcon, {
|
@@ -296,13 +337,19 @@ class HiSelectableListItem extends React.PureComponent {
|
|
296
337
|
}
|
297
338
|
},
|
298
339
|
className: classes.img
|
299
|
-
}), this.buildItemLabel(),
|
340
|
+
}), this.buildItemLabel())), React.createElement("div", {
|
341
|
+
className: classNames(classes.infosContent, {
|
342
|
+
[classes.infosWithoutSecondaryInline]: !secondaryInline,
|
343
|
+
[classes.infosWithSecondaryInline]: !secondaryInline,
|
344
|
+
[classes.infosInlineWithoutSecondary]: secondaryInline && !secondaryLabel
|
345
|
+
})
|
346
|
+
}, !!secondaryLabel && React.createElement("div", {
|
300
347
|
className: classNames(classes.secondaryLabel, {
|
301
348
|
[classes.inline]: secondaryInline
|
302
349
|
})
|
303
|
-
}, secondaryLabel)
|
304
|
-
className: classes.info
|
305
|
-
}, info));
|
350
|
+
}, secondaryLabel), !!info && React.createElement("span", {
|
351
|
+
className: classNames(classes.info)
|
352
|
+
}, info)));
|
306
353
|
}
|
307
354
|
|
308
355
|
}
|
@@ -411,12 +458,12 @@ HiSelectableListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
411
458
|
/**
|
412
459
|
* Fonction de callback à la sélection de l'élément
|
413
460
|
*/
|
414
|
-
|
461
|
+
onKeyDown: PropTypes.func,
|
415
462
|
|
416
463
|
/**
|
417
464
|
* Fonction de callback à la sélection de l'élément
|
418
465
|
*/
|
419
|
-
|
466
|
+
onSelect: PropTypes.func,
|
420
467
|
|
421
468
|
/**
|
422
469
|
* Padding par défaut des éléments
|
@@ -2,153 +2,157 @@
|
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import TableCell from '@material-ui/core/TableCell';
|
5
|
-
import CellAddress from '
|
6
|
-
import CellDate from '
|
7
|
-
import CellIcon from '
|
8
|
-
import CellImage from '
|
9
|
-
import CellNumeric from '
|
10
|
-
import CellSentinel from '
|
11
|
-
import CellSentinelScore from '
|
12
|
-
import
|
13
|
-
import CellRate from '
|
14
|
-
import CellPinToAction from '
|
5
|
+
import CellAddress from '../HiCell/CellAddress';
|
6
|
+
import CellDate from '../HiCell/CellDate';
|
7
|
+
import CellIcon from '../HiCell/CellIcon';
|
8
|
+
import CellImage from '../HiCell/CellImage';
|
9
|
+
import CellNumeric from '../HiCell/CellNumeric';
|
10
|
+
import CellSentinel from '../HiCell/CellSentinel';
|
11
|
+
import CellSentinelScore from '../HiCell/CellSentinelScore';
|
12
|
+
import CellTextStyled from '../HiCell/CellTextStyled';
|
13
|
+
import CellRate from '../HiCell/CellRate';
|
14
|
+
import CellPinToAction from '../HiCell/CellPinToAction';
|
15
15
|
import * as cst from './constants';
|
16
16
|
|
17
17
|
class HiCellBuilder extends React.PureComponent {
|
18
|
-
|
19
|
-
|
20
|
-
let datacell = rowdata.datas[cell.colId];
|
21
|
-
|
22
|
-
if (cell.data !== undefined) {
|
23
|
-
const refproperties = cell.data.find(el => el.id === datacell.value);
|
24
|
-
|
25
|
-
if (refproperties) {
|
26
|
-
Object.keys(refproperties).forEach(key => {
|
27
|
-
datacell[key] = refproperties[key];
|
28
|
-
});
|
29
|
-
} else {
|
30
|
-
datacell = undefined;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
if (datacell) {
|
35
|
-
switch (cell.type) {
|
36
|
-
case cst.TYPE_NUMERIC:
|
37
|
-
return React.createElement(CellNumeric, {
|
38
|
-
value: datacell.value,
|
39
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
40
|
-
precision: cell.precision,
|
41
|
-
currency: datacell.currency,
|
42
|
-
locale: datacell.locale || cell.locale || locale
|
43
|
-
});
|
44
|
-
|
45
|
-
case cst.TYPE_COUNTRY:
|
46
|
-
return React.createElement(CellImage, {
|
47
|
-
label: datacell.label,
|
48
|
-
shortLabel: datacell.id,
|
49
|
-
path: datacell.img,
|
50
|
-
size: datacell.size,
|
51
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
52
|
-
});
|
53
|
-
|
54
|
-
case cst.TYPE_IMAGE:
|
55
|
-
return React.createElement(CellImage, {
|
56
|
-
label: datacell.label,
|
57
|
-
shortLabel: datacell.id,
|
58
|
-
path: datacell.img,
|
59
|
-
size: datacell.size,
|
60
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
61
|
-
});
|
62
|
-
|
63
|
-
case cst.TYPE_RATE:
|
64
|
-
return React.createElement(CellRate, {
|
65
|
-
indicator: datacell.indicator,
|
66
|
-
isPositive: datacell.isPositive,
|
67
|
-
locale: datacell.locale || cell.locale || locale,
|
68
|
-
value: datacell.value,
|
69
|
-
trendchip: datacell.trendchip,
|
70
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
71
|
-
});
|
72
|
-
|
73
|
-
case cst.TYPE_ADDRESS:
|
74
|
-
return React.createElement(CellAddress, {
|
75
|
-
city: datacell.city,
|
76
|
-
country: datacell.country,
|
77
|
-
isoCountry: datacell.isoCountry,
|
78
|
-
name: datacell.name,
|
79
|
-
postalCode: datacell.postalCode,
|
80
|
-
streetAddress: datacell.streetAddress,
|
81
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
82
|
-
});
|
18
|
+
constructor(...args) {
|
19
|
+
super(...args);
|
83
20
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
displayTime: datacell.displayTime,
|
88
|
-
formatShort: datacell.formatShort,
|
89
|
-
locale: datacell.locale || cell.precision || locale,
|
90
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
91
|
-
});
|
92
|
-
|
93
|
-
case cst.TYPE_ICON:
|
94
|
-
return React.createElement(CellIcon, {
|
95
|
-
color: datacell.color,
|
96
|
-
icon: datacell.icon,
|
97
|
-
label: datacell.label,
|
98
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
99
|
-
size: cell.size
|
100
|
-
});
|
101
|
-
|
102
|
-
case cst.TYPE_THIRD_PARTY_SECURITY:
|
103
|
-
return React.createElement(CellIcon, {
|
104
|
-
color: datacell.color,
|
105
|
-
icon: datacell.icon,
|
106
|
-
label: datacell.label,
|
107
|
-
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
108
|
-
size: cell.size
|
109
|
-
});
|
110
|
-
|
111
|
-
case cst.TYPE_SENTINEL:
|
112
|
-
return React.createElement(CellSentinel, {
|
113
|
-
color: datacell.color,
|
114
|
-
label: datacell.label,
|
115
|
-
letter: datacell.label2,
|
116
|
-
active: datacell.active,
|
117
|
-
reviewer: datacell.reviewer,
|
118
|
-
outlined: datacell.outlined
|
119
|
-
});
|
120
|
-
|
121
|
-
case cst.TYPE_SENTINEL_SCORE:
|
122
|
-
return React.createElement(CellSentinelScore, {
|
123
|
-
value: datacell.value,
|
124
|
-
result: datacell.result
|
125
|
-
});
|
21
|
+
this.createCell = (cell, rowdata, locale) => {
|
22
|
+
if (rowdata.datas[cell.colId]) {
|
23
|
+
let datacell = rowdata.datas[cell.colId];
|
126
24
|
|
127
|
-
|
128
|
-
|
129
|
-
number: datacell.number,
|
130
|
-
onClick: datacell.onClick
|
131
|
-
});
|
25
|
+
if (cell.data !== undefined) {
|
26
|
+
const refproperties = cell.data.find(el => el.id === datacell.value);
|
132
27
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
color: datacell.color,
|
137
|
-
ellipsis: datacell.ellipse
|
28
|
+
if (refproperties) {
|
29
|
+
Object.keys(refproperties).forEach(key => {
|
30
|
+
datacell[key] = refproperties[key];
|
138
31
|
});
|
32
|
+
} else {
|
33
|
+
datacell = undefined;
|
34
|
+
}
|
35
|
+
}
|
139
36
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
37
|
+
if (datacell) {
|
38
|
+
switch (cell.type) {
|
39
|
+
case cst.TYPE_NUMERIC:
|
40
|
+
return React.createElement(CellNumeric, {
|
41
|
+
value: datacell.value,
|
42
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
43
|
+
precision: cell.precision,
|
44
|
+
currency: datacell.currency,
|
45
|
+
locale: datacell.locale || cell.locale || locale
|
46
|
+
});
|
47
|
+
|
48
|
+
case cst.TYPE_COUNTRY:
|
49
|
+
return React.createElement(CellImage, {
|
50
|
+
label: datacell.label,
|
51
|
+
shortLabel: datacell.id,
|
52
|
+
path: datacell.img,
|
53
|
+
size: datacell.size,
|
54
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
55
|
+
});
|
56
|
+
|
57
|
+
case cst.TYPE_IMAGE:
|
58
|
+
return React.createElement(CellImage, {
|
59
|
+
label: datacell.label,
|
60
|
+
shortLabel: datacell.id,
|
61
|
+
path: datacell.img,
|
62
|
+
size: datacell.size || cell.size,
|
63
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
64
|
+
fallbackImage: datacell.fallbackImage,
|
65
|
+
title: cell.title ? cell.title(datacell, cell) : datacell.title
|
66
|
+
});
|
67
|
+
|
68
|
+
case cst.TYPE_RATE:
|
69
|
+
return React.createElement(CellRate, {
|
70
|
+
indicator: datacell.indicator,
|
71
|
+
isPositive: datacell.isPositive,
|
72
|
+
locale: datacell.locale || cell.locale || locale,
|
73
|
+
value: datacell.value,
|
74
|
+
trendchip: datacell.trendchip,
|
75
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
76
|
+
});
|
77
|
+
|
78
|
+
case cst.TYPE_ADDRESS:
|
79
|
+
return React.createElement(CellAddress, {
|
80
|
+
city: datacell.city,
|
81
|
+
country: datacell.country,
|
82
|
+
isoCountry: datacell.isoCountry,
|
83
|
+
name: datacell.name,
|
84
|
+
postalCode: datacell.postalCode,
|
85
|
+
streetAddress: datacell.streetAddress,
|
86
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
87
|
+
});
|
88
|
+
|
89
|
+
case cst.TYPE_DATE:
|
90
|
+
return React.createElement(CellDate, {
|
91
|
+
date: datacell.date,
|
92
|
+
displayTime: datacell.displayTime,
|
93
|
+
formatShort: datacell.formatShort,
|
94
|
+
locale: datacell.locale || cell.precision || locale,
|
95
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type]
|
96
|
+
});
|
97
|
+
|
98
|
+
case cst.TYPE_ICON:
|
99
|
+
return React.createElement(CellIcon, {
|
100
|
+
color: datacell.color,
|
101
|
+
icon: datacell.icon,
|
102
|
+
label: datacell.label,
|
103
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
104
|
+
size: cell.size
|
105
|
+
});
|
106
|
+
|
107
|
+
case cst.TYPE_THIRD_PARTY_SECURITY:
|
108
|
+
return React.createElement(CellIcon, {
|
109
|
+
color: datacell.color,
|
110
|
+
icon: datacell.icon,
|
111
|
+
label: datacell.label,
|
112
|
+
view: cell.view ? cell.view : cst.DEFAULT_VIEWS[cell.type],
|
113
|
+
size: cell.size
|
114
|
+
});
|
115
|
+
|
116
|
+
case cst.TYPE_SENTINEL:
|
117
|
+
return React.createElement(CellSentinel, {
|
118
|
+
color: datacell.color,
|
119
|
+
label: datacell.label,
|
120
|
+
letter: datacell.label2,
|
121
|
+
active: datacell.active,
|
122
|
+
reviewer: datacell.reviewer,
|
123
|
+
outlined: datacell.outlined
|
124
|
+
});
|
125
|
+
|
126
|
+
case cst.TYPE_SENTINEL_SCORE:
|
127
|
+
return React.createElement(CellSentinelScore, {
|
128
|
+
value: datacell.value,
|
129
|
+
result: datacell.result,
|
130
|
+
active: datacell.active
|
131
|
+
});
|
132
|
+
|
133
|
+
case cst.TYPE_PIN_TO_ACTION:
|
134
|
+
return React.createElement(CellPinToAction, {
|
135
|
+
number: datacell.number // eslint-disable-next-line react/jsx-handler-names
|
136
|
+
,
|
137
|
+
onClick: datacell.onClick
|
138
|
+
});
|
139
|
+
|
140
|
+
case cst.TYPE_ACCOUNT_NUMBER:
|
141
|
+
case cst.TYPE_CUSTOMER_ACCOUNT_NUMBER:
|
142
|
+
default:
|
143
|
+
return React.createElement(CellTextStyled, {
|
144
|
+
active: datacell.active,
|
145
|
+
color: datacell.color,
|
146
|
+
label: datacell.label,
|
147
|
+
title: cell.title ? cell.title(datacell, cell) : datacell.title,
|
148
|
+
value: datacell.value
|
149
|
+
});
|
150
|
+
}
|
147
151
|
}
|
148
152
|
}
|
149
|
-
}
|
150
153
|
|
151
|
-
|
154
|
+
return null;
|
155
|
+
};
|
152
156
|
}
|
153
157
|
|
154
158
|
render() {
|
@@ -5,15 +5,16 @@ import withStyles from '../styles/withStyles';
|
|
5
5
|
import TableCell from '@material-ui/core/TableCell';
|
6
6
|
import TableHead from '@material-ui/core/TableHead';
|
7
7
|
import TableRow from '@material-ui/core/TableRow';
|
8
|
-
import Tooltip from '@material-ui/core/Tooltip';
|
9
8
|
import TableSortLabel from '@material-ui/core/TableSortLabel';
|
10
9
|
import * as cst from './constants';
|
11
|
-
|
12
|
-
const styles = theme => ({
|
10
|
+
const styles = {
|
13
11
|
icon: {
|
14
12
|
color: '#00ADE9'
|
13
|
+
},
|
14
|
+
headerRoot: {
|
15
|
+
cursor: 'inherit'
|
15
16
|
}
|
16
|
-
}
|
17
|
+
};
|
17
18
|
|
18
19
|
class HiTableHeader extends React.PureComponent {
|
19
20
|
constructor(...args) {
|
@@ -38,29 +39,36 @@ class HiTableHeader extends React.PureComponent {
|
|
38
39
|
height: dense ? cst.CELL_HEADER_HEIGHT_DENSE : cst.CELL_HEADER_HEIGHT,
|
39
40
|
whiteSpace: 'nowrap'
|
40
41
|
}
|
41
|
-
}, Object.keys(columns).map(
|
42
|
-
const
|
42
|
+
}, Object.keys(columns).map(key => {
|
43
|
+
const {
|
44
|
+
colId,
|
45
|
+
type,
|
46
|
+
label,
|
47
|
+
smallLabel,
|
48
|
+
view,
|
49
|
+
headerTooltip
|
50
|
+
} = columns[key];
|
51
|
+
const finalLabel = view === 's' ? smallLabel : label;
|
43
52
|
return React.createElement(TableCell, {
|
44
|
-
key:
|
45
|
-
sortDirection: orderBy ===
|
53
|
+
key: colId,
|
54
|
+
sortDirection: orderBy === colId ? order : false,
|
46
55
|
style: {
|
47
56
|
border: 'none',
|
48
|
-
borderBottom: orderBy ===
|
57
|
+
borderBottom: orderBy === colId ? 'solid 1px #00ADE9' : 'none',
|
49
58
|
paddingRight: '13px',
|
50
59
|
paddingLeft: '13px'
|
51
60
|
},
|
52
|
-
numeric:
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}, React.createElement(TableSortLabel, {
|
57
|
-
active: orderBy === column.colId,
|
61
|
+
numeric: cst.ALIGN_RIGHT_TYPES.includes(type),
|
62
|
+
title: headerTooltip
|
63
|
+
}, sortable ? React.createElement(TableSortLabel, {
|
64
|
+
active: orderBy === colId,
|
58
65
|
direction: order,
|
59
|
-
onClick: this.createSortHandler(
|
66
|
+
onClick: this.createSortHandler(colId),
|
60
67
|
classes: {
|
61
68
|
icon: classes.icon
|
62
|
-
}
|
63
|
-
|
69
|
+
},
|
70
|
+
title: headerTooltip || label
|
71
|
+
}, finalLabel) : finalLabel);
|
64
72
|
}, this)));
|
65
73
|
}
|
66
74
|
|