@hipay/hipay-material-ui 2.0.0-beta.51 → 2.0.0-beta.53
Sign up to get free protection for your applications and to get access to all the features.
- package/HiCheckbox/HiCheckbox.js +3 -3
- package/HiChip/HiChip.js +10 -3
- package/HiColoredLabel/HiColoredLabel.js +3 -2
- package/HiPin/HiPin.js +1 -1
- package/HiSelectNew/HiNestedSelectContent.js +13 -75
- package/HiSelectableList/HiSelectableListItem.js +18 -5
- package/HiTable/HiTableRow.js +11 -4
- package/es/HiCheckbox/HiCheckbox.js +1 -1
- package/es/HiChip/HiChip.js +10 -3
- package/es/HiColoredLabel/HiColoredLabel.js +3 -2
- package/es/HiPin/HiPin.js +1 -1
- package/es/HiSelectNew/HiNestedSelectContent.js +5 -64
- package/es/HiSelectableList/HiSelectableListItem.js +14 -3
- package/es/HiTable/HiTableRow.js +10 -4
- package/es/styles/createPalette.js +11 -3
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -1
- package/styles/createPalette.js +12 -3
- package/umd/hipay-material-ui.development.js +51 -21
- package/umd/hipay-material-ui.production.min.js +2 -2
- package/yarn-error.log +110 -0
package/HiCheckbox/HiCheckbox.js
CHANGED
@@ -74,8 +74,8 @@ exports.styles = styles;
|
|
74
74
|
|
75
75
|
var HiCheckbox =
|
76
76
|
/*#__PURE__*/
|
77
|
-
function (_React$
|
78
|
-
(0, _inherits2.default)(HiCheckbox, _React$
|
77
|
+
function (_React$PureComponent) {
|
78
|
+
(0, _inherits2.default)(HiCheckbox, _React$PureComponent);
|
79
79
|
|
80
80
|
function HiCheckbox(props) {
|
81
81
|
var _this;
|
@@ -158,7 +158,7 @@ function (_React$Component) {
|
|
158
158
|
}
|
159
159
|
}]);
|
160
160
|
return HiCheckbox;
|
161
|
-
}(_react.default.
|
161
|
+
}(_react.default.PureComponent);
|
162
162
|
|
163
163
|
HiCheckbox.defaultProps = {
|
164
164
|
checked: false,
|
package/HiChip/HiChip.js
CHANGED
@@ -97,7 +97,8 @@ var styles = function styles(theme) {
|
|
97
97
|
'&:hover, &:focus': {
|
98
98
|
backgroundColor: theme.palette.primary.main,
|
99
99
|
color: theme.palette.grey[300]
|
100
|
-
}
|
100
|
+
},
|
101
|
+
position: 'relative'
|
101
102
|
},
|
102
103
|
badge: {
|
103
104
|
height: 16,
|
@@ -119,7 +120,7 @@ var handleKeyDown = function handleKeyDown(e, fn) {
|
|
119
120
|
function HiChip(props) {
|
120
121
|
var _classNames;
|
121
122
|
|
122
|
-
var
|
123
|
+
var className = props.className,
|
123
124
|
classes = props.classes,
|
124
125
|
fallbackImage = props.fallbackImage,
|
125
126
|
icon = props.icon,
|
@@ -127,6 +128,7 @@ function HiChip(props) {
|
|
127
128
|
iconSize = _props$iconSize === void 0 ? 20 : _props$iconSize,
|
128
129
|
id = props.id,
|
129
130
|
img = props.img,
|
131
|
+
label = props.label,
|
130
132
|
onPrevious = props.onPrevious,
|
131
133
|
onNext = props.onNext,
|
132
134
|
onDelete = props.onDelete,
|
@@ -140,7 +142,7 @@ function HiChip(props) {
|
|
140
142
|
titlePrevious = props.titlePrevious;
|
141
143
|
return _react.default.createElement("div", {
|
142
144
|
id: id,
|
143
|
-
className: (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.leftNavigation, onPrevious), (0, _defineProperty2.default)(_classNames, classes.rightNavigation, onNext), (0, _defineProperty2.default)(_classNames, classes.deletable, onDelete), (0, _defineProperty2.default)(_classNames, classes.leftIcon, icon), _classNames)),
|
145
|
+
className: (0, _classnames.default)(classes.root, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.leftNavigation, onPrevious), (0, _defineProperty2.default)(_classNames, classes.rightNavigation, onNext), (0, _defineProperty2.default)(_classNames, classes.deletable, onDelete), (0, _defineProperty2.default)(_classNames, classes.leftIcon, icon), _classNames)),
|
144
146
|
title: title
|
145
147
|
}, icon && _react.default.createElement(_HiIcon.default, {
|
146
148
|
className: (0, _classnames.default)(classes.icon, (0, _defineProperty2.default)({}, classes.iconClickable, onIconClick)),
|
@@ -209,6 +211,11 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
209
211
|
*/
|
210
212
|
classes: _propTypes.default.object,
|
211
213
|
|
214
|
+
/**
|
215
|
+
* Surcharge les classes du composant
|
216
|
+
*/
|
217
|
+
className: _propTypes.default.object,
|
218
|
+
|
212
219
|
/**
|
213
220
|
* Chemin vers l'image à afficher par défaut si une image n'est pas trouvée
|
214
221
|
*/
|
@@ -136,13 +136,14 @@ function HiColoredLabel(props) {
|
|
136
136
|
color = props.color,
|
137
137
|
active = props.active,
|
138
138
|
fontWeight = props.fontWeight,
|
139
|
+
style = props.style,
|
139
140
|
theme = props.theme,
|
140
|
-
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "label", "color", "active", "fontWeight", "theme"]);
|
141
|
+
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "label", "color", "active", "fontWeight", "style", "theme"]);
|
141
142
|
var isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
142
143
|
var isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
143
144
|
return _react.default.createElement("div", (0, _extends2.default)({
|
144
145
|
className: (0, _classnames.default)(classes.root, (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes.color, !active), (0, _defineProperty2.default)(_classNames, classes.activeColor, active), (0, _defineProperty2.default)(_classNames, classes["activeColor".concat((0, _helpers.capitalize)(color))], active && isHiColor), (0, _defineProperty2.default)(_classNames, classes["color".concat((0, _helpers.capitalize)(color))], !active && isHiColor), _classNames), className),
|
145
|
-
style: (0, _extends2.default)({}, isHexColor && {
|
146
|
+
style: (0, _extends2.default)({}, style, isHexColor && {
|
146
147
|
backgroundColor: active ? color : (0, _colorManipulator.fade)(color, 0.08),
|
147
148
|
color: active ? theme.palette.getContrastText(color) : color
|
148
149
|
}, fontWeight && {
|
package/HiPin/HiPin.js
CHANGED
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.getRecursiveFinalItemIdList = getRecursiveFinalItemIdList;
|
9
9
|
exports.findFinalItemRecursively = findFinalItemRecursively;
|
10
|
-
exports.default =
|
10
|
+
exports.default = void 0;
|
11
11
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
13
|
|
@@ -17,12 +17,10 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
17
17
|
|
18
18
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
19
19
|
|
20
|
-
var
|
20
|
+
var _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
21
21
|
|
22
22
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
23
23
|
|
24
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
25
|
-
|
26
24
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
27
25
|
|
28
26
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
@@ -33,16 +31,12 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
31
|
|
34
32
|
var _HiSelectContent = _interopRequireDefault(require("./HiSelectContent"));
|
35
33
|
|
36
|
-
var _HiIcon = _interopRequireDefault(require("../HiIcon"));
|
37
|
-
|
38
|
-
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
39
|
-
|
40
34
|
var _helpers = require("../utils/helpers");
|
41
35
|
|
42
36
|
// @inheritedComponent HiSelectContent
|
43
37
|
|
44
38
|
/**
|
45
|
-
* Return array of final item id in nested list (via props
|
39
|
+
* Return array of final item id in nested list (via props children)
|
46
40
|
* @param itemList
|
47
41
|
* @param finalItemIdList
|
48
42
|
* @returns {*[]}
|
@@ -156,50 +150,6 @@ function buildFilteredItemList(itemList) {
|
|
156
150
|
v: visibleParent
|
157
151
|
});
|
158
152
|
}
|
159
|
-
|
160
|
-
var styles = function styles(theme) {
|
161
|
-
return {
|
162
|
-
root: {
|
163
|
-
backgroundColor: theme.palette.background2,
|
164
|
-
maxWidth: 500,
|
165
|
-
width: '100%',
|
166
|
-
position: 'relative'
|
167
|
-
},
|
168
|
-
popper: {
|
169
|
-
// width: '100%',
|
170
|
-
zIndex: 1200
|
171
|
-
},
|
172
|
-
paper: {
|
173
|
-
borderRadius: '0px 2px',
|
174
|
-
maxHeight: 480,
|
175
|
-
transition: 'none !important'
|
176
|
-
},
|
177
|
-
labelImg: {
|
178
|
-
height: 18,
|
179
|
-
width: 'auto',
|
180
|
-
margin: '0 4px',
|
181
|
-
verticalAlign: 'middle'
|
182
|
-
},
|
183
|
-
selectIconLabel: (0, _extends2.default)({
|
184
|
-
whiteSpace: 'nowrap',
|
185
|
-
overflow: 'hidden',
|
186
|
-
textOverflow: 'ellipsis',
|
187
|
-
paddingRight: 16
|
188
|
-
}, theme.typography.b1, {
|
189
|
-
display: 'inline-flex',
|
190
|
-
width: '100%'
|
191
|
-
}),
|
192
|
-
selectImgLabel: (0, _extends2.default)({
|
193
|
-
whiteSpace: 'nowrap',
|
194
|
-
overflow: 'hidden',
|
195
|
-
textOverflow: 'ellipsis',
|
196
|
-
paddingRight: 16
|
197
|
-
}, theme.typography.b1, {
|
198
|
-
display: 'inline-flex',
|
199
|
-
width: '100%'
|
200
|
-
})
|
201
|
-
};
|
202
|
-
};
|
203
153
|
/**
|
204
154
|
* HiNestedSelectContent hérite du composant HiSelectContent
|
205
155
|
*
|
@@ -214,18 +164,23 @@ var styles = function styles(theme) {
|
|
214
164
|
*/
|
215
165
|
|
216
166
|
|
217
|
-
exports.styles = styles;
|
218
|
-
|
219
167
|
var HiNestedSelectContent =
|
220
168
|
/*#__PURE__*/
|
221
169
|
function (_React$PureComponent) {
|
222
170
|
(0, _inherits2.default)(HiNestedSelectContent, _React$PureComponent);
|
223
171
|
|
224
|
-
function HiNestedSelectContent(
|
172
|
+
function HiNestedSelectContent() {
|
173
|
+
var _getPrototypeOf2;
|
174
|
+
|
225
175
|
var _this;
|
226
176
|
|
227
177
|
(0, _classCallCheck2.default)(this, HiNestedSelectContent);
|
228
|
-
|
178
|
+
|
179
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
180
|
+
args[_key] = arguments[_key];
|
181
|
+
}
|
182
|
+
|
183
|
+
_this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(HiNestedSelectContent)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
229
184
|
|
230
185
|
_this.handleSelect = function (event, item) {
|
231
186
|
var _this$props = _this.props,
|
@@ -329,20 +284,8 @@ function (_React$PureComponent) {
|
|
329
284
|
};
|
330
285
|
};
|
331
286
|
|
332
|
-
_this.handleSelect = _this.handleSelect.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
333
287
|
return _this;
|
334
288
|
}
|
335
|
-
/**
|
336
|
-
* Call onChange with the updated value
|
337
|
-
*
|
338
|
-
* - handle single value
|
339
|
-
* - handle multiple value
|
340
|
-
* - handle '_all' id
|
341
|
-
*
|
342
|
-
* @param event
|
343
|
-
* @param item
|
344
|
-
*/
|
345
|
-
|
346
289
|
|
347
290
|
(0, _createClass2.default)(HiNestedSelectContent, [{
|
348
291
|
key: "render",
|
@@ -463,10 +406,5 @@ HiNestedSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
463
406
|
*/
|
464
407
|
value: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string, _propTypes.default.array])
|
465
408
|
} : {};
|
466
|
-
|
467
|
-
var _default = (0, _withStyles.default)(styles, {
|
468
|
-
hiComponent: true,
|
469
|
-
name: 'HmuiHiNestedSelectContent'
|
470
|
-
})(HiNestedSelectContent);
|
471
|
-
|
409
|
+
var _default = HiNestedSelectContent;
|
472
410
|
exports.default = _default;
|
@@ -45,6 +45,11 @@ var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
|
45
45
|
|
46
46
|
var _helpers = require("../utils/helpers");
|
47
47
|
|
48
|
+
var _pure = _interopRequireDefault(require("recompose/pure"));
|
49
|
+
|
50
|
+
var PureListSubheader = (0, _pure.default)(_ListSubheader.default);
|
51
|
+
var PureListItem = (0, _pure.default)(_ListItem.default);
|
52
|
+
|
48
53
|
var styles = function styles(theme) {
|
49
54
|
return {
|
50
55
|
root: {
|
@@ -170,8 +175,8 @@ exports.styles = styles;
|
|
170
175
|
|
171
176
|
var HiSelectableListItem =
|
172
177
|
/*#__PURE__*/
|
173
|
-
function (_React$
|
174
|
-
(0, _inherits2.default)(HiSelectableListItem, _React$
|
178
|
+
function (_React$PureComponent) {
|
179
|
+
(0, _inherits2.default)(HiSelectableListItem, _React$PureComponent);
|
175
180
|
|
176
181
|
function HiSelectableListItem(props) {
|
177
182
|
var _this;
|
@@ -256,6 +261,7 @@ function (_React$Component) {
|
|
256
261
|
fallbackImage = _this$props2.fallbackImage,
|
257
262
|
hideCheckbox = _this$props2.hideCheckbox,
|
258
263
|
onSelect = _this$props2.onSelect,
|
264
|
+
onKeyDown = _this$props2.onKeyDown,
|
259
265
|
indeterminate = _this$props2.indeterminate,
|
260
266
|
indeterminateIcon = _this$props2.indeterminateIcon,
|
261
267
|
icon = _this$props2.icon,
|
@@ -288,7 +294,7 @@ function (_React$Component) {
|
|
288
294
|
displayedIcon = icon;
|
289
295
|
}
|
290
296
|
|
291
|
-
var ListItemComponentName = pinned ?
|
297
|
+
var ListItemComponentName = pinned ? PureListSubheader : PureListItem;
|
292
298
|
return _react.default.createElement(ListItemComponentName, (0, _extends2.default)({
|
293
299
|
id: id,
|
294
300
|
tabIndex: disabled ? '-1' : 0,
|
@@ -301,12 +307,14 @@ function (_React$Component) {
|
|
301
307
|
}, disabled || {
|
302
308
|
onClick: onSelect,
|
303
309
|
onMouseEnter: this.setHover(true),
|
304
|
-
onMouseLeave: this.setHover(false)
|
310
|
+
onMouseLeave: this.setHover(false),
|
311
|
+
onKeyDown: onKeyDown
|
305
312
|
}, {
|
306
313
|
style: {
|
307
314
|
paddingLeft: "".concat(paddingLeft + level * 32, "px")
|
308
315
|
}
|
309
316
|
}), !hideCheckbox && !pinned && _react.default.createElement(_HiCheckbox.default, {
|
317
|
+
tabIndex: onKeyDown ? '-1' : 0,
|
310
318
|
checked: selected,
|
311
319
|
checkedIcon: checkedIcon,
|
312
320
|
classes: {
|
@@ -342,7 +350,7 @@ function (_React$Component) {
|
|
342
350
|
}
|
343
351
|
}]);
|
344
352
|
return HiSelectableListItem;
|
345
|
-
}(_react.default.
|
353
|
+
}(_react.default.PureComponent);
|
346
354
|
|
347
355
|
HiSelectableListItem.defaultProps = {
|
348
356
|
centered: false,
|
@@ -450,6 +458,11 @@ HiSelectableListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
450
458
|
*/
|
451
459
|
onSelect: _propTypes.default.func,
|
452
460
|
|
461
|
+
/**
|
462
|
+
* Fonction de callback à la sélection de l'élément
|
463
|
+
*/
|
464
|
+
onKeyDown: _propTypes.default.func,
|
465
|
+
|
453
466
|
/**
|
454
467
|
* Padding par défaut des éléments
|
455
468
|
*/
|
package/HiTable/HiTableRow.js
CHANGED
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
9
9
|
});
|
10
10
|
exports.default = exports.styles = void 0;
|
11
11
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
13
|
+
|
12
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
13
15
|
|
14
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
@@ -27,6 +29,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
29
|
|
28
30
|
var _keycode = _interopRequireDefault(require("keycode"));
|
29
31
|
|
32
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
33
|
+
|
30
34
|
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
31
35
|
|
32
36
|
var _TableRow = _interopRequireDefault(require("@material-ui/core/TableRow"));
|
@@ -48,6 +52,9 @@ var styles = function styles(theme) {
|
|
48
52
|
'&:hover, &:focus': {
|
49
53
|
backgroundColor: "".concat(theme.palette.action.hover, " !important")
|
50
54
|
}
|
55
|
+
},
|
56
|
+
clicableRow: {
|
57
|
+
cursor: 'pointer'
|
51
58
|
}
|
52
59
|
};
|
53
60
|
};
|
@@ -88,7 +95,7 @@ function (_React$PureComponent) {
|
|
88
95
|
locale = _this$props.locale,
|
89
96
|
rowdata = _this$props.rowdata;
|
90
97
|
return _react.default.createElement(_TableRow.default, {
|
91
|
-
className: classes.row,
|
98
|
+
className: (0, _classnames.default)(classes.row, (0, _defineProperty2.default)({}, classes.clicableRow, this.props.onClick)),
|
92
99
|
hover: true,
|
93
100
|
onClick: function onClick(event) {
|
94
101
|
return _this2.handleClick(event, rowdata);
|
@@ -105,10 +112,10 @@ function (_React$PureComponent) {
|
|
105
112
|
height: dense ? cst.CELL_HEIGHT_DENSE : cst.CELL_HEIGHT
|
106
113
|
},
|
107
114
|
tabIndex: 0
|
108
|
-
}, Object.keys(columns).map(function (
|
115
|
+
}, Object.keys(columns).map(function (column) {
|
109
116
|
return _react.default.createElement(_HiCellBuilder.default, {
|
110
|
-
key: columns[
|
111
|
-
column: columns[
|
117
|
+
key: columns[column].colId,
|
118
|
+
column: columns[column],
|
112
119
|
data: rowdata,
|
113
120
|
locale: locale
|
114
121
|
});
|
package/es/HiChip/HiChip.js
CHANGED
@@ -78,7 +78,8 @@ export const styles = theme => ({
|
|
78
78
|
'&:hover, &:focus': {
|
79
79
|
backgroundColor: theme.palette.primary.main,
|
80
80
|
color: theme.palette.grey[300]
|
81
|
-
}
|
81
|
+
},
|
82
|
+
position: 'relative'
|
82
83
|
},
|
83
84
|
badge: {
|
84
85
|
height: 16,
|
@@ -96,13 +97,14 @@ const handleKeyDown = (e, fn) => {
|
|
96
97
|
|
97
98
|
function HiChip(props) {
|
98
99
|
const {
|
99
|
-
|
100
|
+
className,
|
100
101
|
classes,
|
101
102
|
fallbackImage,
|
102
103
|
icon,
|
103
104
|
iconSize = 20,
|
104
105
|
id,
|
105
106
|
img,
|
107
|
+
label,
|
106
108
|
onPrevious,
|
107
109
|
onNext,
|
108
110
|
onDelete,
|
@@ -117,7 +119,7 @@ function HiChip(props) {
|
|
117
119
|
} = props;
|
118
120
|
return React.createElement("div", {
|
119
121
|
id: id,
|
120
|
-
className: classNames(classes.root, {
|
122
|
+
className: classNames(classes.root, className, {
|
121
123
|
[classes.leftNavigation]: onPrevious,
|
122
124
|
[classes.rightNavigation]: onNext,
|
123
125
|
[classes.deletable]: onDelete,
|
@@ -185,6 +187,11 @@ HiChip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
185
187
|
*/
|
186
188
|
classes: PropTypes.object,
|
187
189
|
|
190
|
+
/**
|
191
|
+
* Surcharge les classes du composant
|
192
|
+
*/
|
193
|
+
className: PropTypes.object,
|
194
|
+
|
188
195
|
/**
|
189
196
|
* Chemin vers l'image à afficher par défaut si une image n'est pas trouvée
|
190
197
|
*/
|
@@ -112,9 +112,10 @@ function HiColoredLabel(props) {
|
|
112
112
|
color,
|
113
113
|
active,
|
114
114
|
fontWeight,
|
115
|
+
style,
|
115
116
|
theme
|
116
117
|
} = props,
|
117
|
-
other = _objectWithoutProperties(props, ["classes", "className", "label", "color", "active", "fontWeight", "theme"]);
|
118
|
+
other = _objectWithoutProperties(props, ["classes", "className", "label", "color", "active", "fontWeight", "style", "theme"]);
|
118
119
|
|
119
120
|
const isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
120
121
|
const isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
@@ -125,7 +126,7 @@ function HiColoredLabel(props) {
|
|
125
126
|
[classes[`activeColor${capitalize(color)}`]]: active && isHiColor,
|
126
127
|
[classes[`color${capitalize(color)}`]]: !active && isHiColor
|
127
128
|
}, className),
|
128
|
-
style: _objectSpread({}, isHexColor && {
|
129
|
+
style: _objectSpread({}, style, isHexColor && {
|
129
130
|
backgroundColor: active ? color : fade(color, 0.08),
|
130
131
|
color: active ? theme.palette.getContrastText(color) : color
|
131
132
|
}, fontWeight && {
|
package/es/HiPin/HiPin.js
CHANGED
@@ -5,11 +5,9 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread";
|
|
5
5
|
import React from 'react';
|
6
6
|
import PropTypes from 'prop-types';
|
7
7
|
import HiSelectContent from './HiSelectContent';
|
8
|
-
import HiIcon from '../HiIcon';
|
9
|
-
import withStyles from '../styles/withStyles';
|
10
8
|
import { foldAccents } from '../utils/helpers';
|
11
9
|
/**
|
12
|
-
* Return array of final item id in nested list (via props
|
10
|
+
* Return array of final item id in nested list (via props children)
|
13
11
|
* @param itemList
|
14
12
|
* @param finalItemIdList
|
15
13
|
* @returns {*[]}
|
@@ -116,48 +114,6 @@ function buildFilteredItemList(itemList, selectedItemIdList = [], searchValue =
|
|
116
114
|
v: visibleParent
|
117
115
|
});
|
118
116
|
}
|
119
|
-
|
120
|
-
export const styles = theme => ({
|
121
|
-
root: {
|
122
|
-
backgroundColor: theme.palette.background2,
|
123
|
-
maxWidth: 500,
|
124
|
-
width: '100%',
|
125
|
-
position: 'relative'
|
126
|
-
},
|
127
|
-
popper: {
|
128
|
-
// width: '100%',
|
129
|
-
zIndex: 1200
|
130
|
-
},
|
131
|
-
paper: {
|
132
|
-
borderRadius: '0px 2px',
|
133
|
-
maxHeight: 480,
|
134
|
-
transition: 'none !important'
|
135
|
-
},
|
136
|
-
labelImg: {
|
137
|
-
height: 18,
|
138
|
-
width: 'auto',
|
139
|
-
margin: '0 4px',
|
140
|
-
verticalAlign: 'middle'
|
141
|
-
},
|
142
|
-
selectIconLabel: _objectSpread({
|
143
|
-
whiteSpace: 'nowrap',
|
144
|
-
overflow: 'hidden',
|
145
|
-
textOverflow: 'ellipsis',
|
146
|
-
paddingRight: 16
|
147
|
-
}, theme.typography.b1, {
|
148
|
-
display: 'inline-flex',
|
149
|
-
width: '100%'
|
150
|
-
}),
|
151
|
-
selectImgLabel: _objectSpread({
|
152
|
-
whiteSpace: 'nowrap',
|
153
|
-
overflow: 'hidden',
|
154
|
-
textOverflow: 'ellipsis',
|
155
|
-
paddingRight: 16
|
156
|
-
}, theme.typography.b1, {
|
157
|
-
display: 'inline-flex',
|
158
|
-
width: '100%'
|
159
|
-
})
|
160
|
-
});
|
161
117
|
/**
|
162
118
|
* HiNestedSelectContent hérite du composant HiSelectContent
|
163
119
|
*
|
@@ -171,9 +127,10 @@ export const styles = theme => ({
|
|
171
127
|
* - si aucun enfant n'est sélectionné, le parent est affiché "unselected".
|
172
128
|
*/
|
173
129
|
|
130
|
+
|
174
131
|
class HiNestedSelectContent extends React.PureComponent {
|
175
|
-
constructor(
|
176
|
-
super(
|
132
|
+
constructor(...args) {
|
133
|
+
super(...args);
|
177
134
|
|
178
135
|
this.handleSelect = (event, item) => {
|
179
136
|
const {
|
@@ -267,20 +224,7 @@ class HiNestedSelectContent extends React.PureComponent {
|
|
267
224
|
itemList
|
268
225
|
};
|
269
226
|
};
|
270
|
-
|
271
|
-
this.handleSelect = this.handleSelect.bind(this);
|
272
227
|
}
|
273
|
-
/**
|
274
|
-
* Call onChange with the updated value
|
275
|
-
*
|
276
|
-
* - handle single value
|
277
|
-
* - handle multiple value
|
278
|
-
* - handle '_all' id
|
279
|
-
*
|
280
|
-
* @param event
|
281
|
-
* @param item
|
282
|
-
*/
|
283
|
-
|
284
228
|
|
285
229
|
render() {
|
286
230
|
const _this$props = this.props,
|
@@ -400,7 +344,4 @@ HiNestedSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
400
344
|
*/
|
401
345
|
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array])
|
402
346
|
} : {};
|
403
|
-
export default
|
404
|
-
hiComponent: true,
|
405
|
-
name: 'HmuiHiNestedSelectContent'
|
406
|
-
})(HiNestedSelectContent);
|
347
|
+
export default HiNestedSelectContent;
|
@@ -11,6 +11,9 @@ import HiColoredLabel from '../HiColoredLabel';
|
|
11
11
|
import HiLoader from '../HiLoader';
|
12
12
|
import withStyles from '../styles/withStyles';
|
13
13
|
import { escapeHTML } from '../utils/helpers';
|
14
|
+
import pure from 'recompose/pure';
|
15
|
+
const PureListSubheader = pure(ListSubheader);
|
16
|
+
const PureListItem = pure(ListItem);
|
14
17
|
export const styles = theme => ({
|
15
18
|
root: {
|
16
19
|
paddingLeft: 4
|
@@ -129,7 +132,7 @@ export const styles = theme => ({
|
|
129
132
|
* Construit un élément de liste sélectionnable (avec checkbox)
|
130
133
|
*/
|
131
134
|
|
132
|
-
class HiSelectableListItem extends React.
|
135
|
+
class HiSelectableListItem extends React.PureComponent {
|
133
136
|
constructor(props) {
|
134
137
|
super(props);
|
135
138
|
|
@@ -202,6 +205,7 @@ class HiSelectableListItem extends React.Component {
|
|
202
205
|
fallbackImage,
|
203
206
|
hideCheckbox,
|
204
207
|
onSelect,
|
208
|
+
onKeyDown,
|
205
209
|
indeterminate,
|
206
210
|
indeterminateIcon,
|
207
211
|
icon,
|
@@ -235,7 +239,7 @@ class HiSelectableListItem extends React.Component {
|
|
235
239
|
displayedIcon = icon;
|
236
240
|
}
|
237
241
|
|
238
|
-
const ListItemComponentName = pinned ?
|
242
|
+
const ListItemComponentName = pinned ? PureListSubheader : PureListItem;
|
239
243
|
return React.createElement(ListItemComponentName, _extends({
|
240
244
|
id: id,
|
241
245
|
tabIndex: disabled ? '-1' : 0,
|
@@ -254,12 +258,14 @@ class HiSelectableListItem extends React.Component {
|
|
254
258
|
}, disabled || {
|
255
259
|
onClick: onSelect,
|
256
260
|
onMouseEnter: this.setHover(true),
|
257
|
-
onMouseLeave: this.setHover(false)
|
261
|
+
onMouseLeave: this.setHover(false),
|
262
|
+
onKeyDown: onKeyDown
|
258
263
|
}, {
|
259
264
|
style: {
|
260
265
|
paddingLeft: `${paddingLeft + level * 32}px`
|
261
266
|
}
|
262
267
|
}), !hideCheckbox && !pinned && React.createElement(HiCheckbox, {
|
268
|
+
tabIndex: onKeyDown ? '-1' : 0,
|
263
269
|
checked: selected,
|
264
270
|
checkedIcon: checkedIcon,
|
265
271
|
classes: {
|
@@ -407,6 +413,11 @@ HiSelectableListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
407
413
|
*/
|
408
414
|
onSelect: PropTypes.func,
|
409
415
|
|
416
|
+
/**
|
417
|
+
* Fonction de callback à la sélection de l'élément
|
418
|
+
*/
|
419
|
+
onKeyDown: PropTypes.func,
|
420
|
+
|
410
421
|
/**
|
411
422
|
* Padding par défaut des éléments
|
412
423
|
*/
|
package/es/HiTable/HiTableRow.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import keycode from 'keycode';
|
5
|
+
import classNames from 'classnames';
|
5
6
|
import withStyles from '../styles/withStyles';
|
6
7
|
import TableRow from '@material-ui/core/TableRow';
|
7
8
|
import HiCellBuilder from './HiCellBuilder';
|
@@ -17,6 +18,9 @@ export const styles = theme => ({
|
|
17
18
|
'&:hover, &:focus': {
|
18
19
|
backgroundColor: `${theme.palette.action.hover} !important`
|
19
20
|
}
|
21
|
+
},
|
22
|
+
clicableRow: {
|
23
|
+
cursor: 'pointer'
|
20
24
|
}
|
21
25
|
});
|
22
26
|
|
@@ -42,7 +46,9 @@ class HiTableRow extends React.PureComponent {
|
|
42
46
|
rowdata
|
43
47
|
} = this.props;
|
44
48
|
return React.createElement(TableRow, {
|
45
|
-
className: classes.row,
|
49
|
+
className: classNames(classes.row, {
|
50
|
+
[classes.clicableRow]: this.props.onClick
|
51
|
+
}),
|
46
52
|
hover: true,
|
47
53
|
onClick: event => this.handleClick(event, rowdata),
|
48
54
|
onKeyDown: event => {
|
@@ -56,10 +62,10 @@ class HiTableRow extends React.PureComponent {
|
|
56
62
|
height: dense ? cst.CELL_HEIGHT_DENSE : cst.CELL_HEIGHT
|
57
63
|
},
|
58
64
|
tabIndex: 0
|
59
|
-
}, Object.keys(columns).map(
|
65
|
+
}, Object.keys(columns).map(column => {
|
60
66
|
return React.createElement(HiCellBuilder, {
|
61
|
-
key: columns[
|
62
|
-
column: columns[
|
67
|
+
key: columns[column].colId,
|
68
|
+
column: columns[column],
|
63
69
|
data: rowdata,
|
64
70
|
locale: locale
|
65
71
|
});
|