@hipay/hipay-material-ui 2.0.0-beta.58 → 2.0.0-beta.59
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +59 -0
- package/HiColoredLabel/HiColoredLabel.js +16 -4
- package/HiForm/HiInput.js +13 -0
- package/HiSelect/HiSuggestSelect.js +3 -3
- package/HiSelectNew/HiNestedSelect.js +20 -6
- package/HiSelectNew/HiNestedSelectContent.js +20 -6
- package/HiSelectNew/HiSelect.js +29 -17
- package/HiSelectNew/HiSelectContent.js +16 -4
- package/HiSelectNew/HiSelectInput.js +4 -4
- package/HiSelectableList/HiSelectableListItem.js +6 -4
- package/es/HiColoredLabel/HiColoredLabel.js +21 -4
- package/es/HiForm/HiInput.js +13 -0
- package/es/HiSelect/HiSuggestSelect.js +3 -3
- package/es/HiSelectNew/HiNestedSelect.js +17 -7
- package/es/HiSelectNew/HiNestedSelectContent.js +16 -6
- package/es/HiSelectNew/HiSelect.js +28 -15
- package/es/HiSelectNew/HiSelectContent.js +11 -2
- package/es/HiSelectNew/HiSelectInput.js +4 -3
- package/es/HiSelectableList/HiSelectableListItem.js +6 -4
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/umd/hipay-material-ui.development.js +16496 -21668
- package/umd/hipay-material-ui.production.min.js +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,62 @@
|
|
1
|
+
<a name="2.0.0-beta.59"></a>
|
2
|
+
# [2.0.0-beta.59](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.59) (2018-12-27)
|
3
|
+
|
4
|
+
|
5
|
+
### Bug Fixes
|
6
|
+
|
7
|
+
* **eslint:** remove eslint warrnings in components (ignore test files) ([d236c62](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d236c62))
|
8
|
+
* **HiBreadcrumb:** clean eslint warnings ([6db12fb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6db12fb))
|
9
|
+
* **HiDatePicker:** add static positions for custom overlays ([c3edf24](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c3edf24))
|
10
|
+
* **HiExpansionPanel:** Fix props type a requirement ([cbc3b48](https://gitlab.hipay.org/backend/hipay-material-ui/commit/cbc3b48))
|
11
|
+
* **HiInput:** handle focus state through prop when needed to override default comportment ([9a133cc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9a133cc))
|
12
|
+
* **HiKpiNotice:** eslint clean warnings ([11b5552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/11b5552))
|
13
|
+
* **HiSelect:** Fix build of HiSelectContent ([4b87f78](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4b87f78))
|
14
|
+
* **HiSelect:** focus on undefined item ([2d084e6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2d084e6))
|
15
|
+
* **HiSelect:** handle staticPosition & width properly for HiDateRangeSelector usage ([7b19ffb](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7b19ffb))
|
16
|
+
* **HiSelectableListItem:** disabled item checkbox color ([9f10552](https://gitlab.hipay.org/backend/hipay-material-ui/commit/9f10552))
|
17
|
+
* **HiSelectableListItem:** remove item width ([a913945](https://gitlab.hipay.org/backend/hipay-material-ui/commit/a913945))
|
18
|
+
* **HiSelectContent:** Remove compute of input value ([b86db83](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b86db83))
|
19
|
+
* **HiSlider:** eslint clean warnings ([08964b1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/08964b1))
|
20
|
+
* **HiUploadField:** clean eslint warnings ([c76aaf1](https://gitlab.hipay.org/backend/hipay-material-ui/commit/c76aaf1))
|
21
|
+
* **migration:** fix contrast threshold ... ([6fb3b18](https://gitlab.hipay.org/backend/hipay-material-ui/commit/6fb3b18))
|
22
|
+
* **package:** add cross-env ([7098fd6](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7098fd6))
|
23
|
+
|
24
|
+
|
25
|
+
### Features
|
26
|
+
|
27
|
+
* **CellImage:** Handle fallbackImage ([254799d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/254799d))
|
28
|
+
* **CellSentinel:** Uniformize cell api with front CellSentinel ([4e2975b](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4e2975b))
|
29
|
+
* **CellSentinel:** Update CellSentinel to the new way (split each result in different column) ([efe2711](https://gitlab.hipay.org/backend/hipay-material-ui/commit/efe2711))
|
30
|
+
* **CellSentinelScore:** Add CellSentinelScore ([2fff04d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/2fff04d))
|
31
|
+
* **CellText:** Handle active prop in CellText & column views in HiTable ([4366e60](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4366e60))
|
32
|
+
* **HiCells:** Add simple cells types (Address, Date, Icon, Image, Numeric, PinToAction, Rate, Senti ([f688517](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f688517))
|
33
|
+
* **HiDatePicker:** BREAKING CHANGE - add local prop to handle calendar translations ([b1b3743](https://gitlab.hipay.org/backend/hipay-material-ui/commit/b1b3743))
|
34
|
+
* **HiIcon:** Add mdi-material-ui as available icons via 'mdi_' prefix ([1091d6d](https://gitlab.hipay.org/backend/hipay-material-ui/commit/1091d6d))
|
35
|
+
* **HiMap:** unregister fetch on unmount ([0afa931](https://gitlab.hipay.org/backend/hipay-material-ui/commit/0afa931))
|
36
|
+
* **HiSelect:** Add (NEW) HiSelect, HiNestedSelect, HiDynamicSelect ([4c6447e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/4c6447e))
|
37
|
+
* **HiSelect:** Reset search input on blur & on close ([d9af584](https://gitlab.hipay.org/backend/hipay-material-ui/commit/d9af584))
|
38
|
+
* **HiSelectableList:** Add sort props to sort item list on label ([f412ddc](https://gitlab.hipay.org/backend/hipay-material-ui/commit/f412ddc))
|
39
|
+
* **HiSelectContent:** Add new HiSelectContent & HiNestedSelectContent ([215ad8f](https://gitlab.hipay.org/backend/hipay-material-ui/commit/215ad8f))
|
40
|
+
* **HiSelectContent:** export utils functions ([7c41d87](https://gitlab.hipay.org/backend/hipay-material-ui/commit/7c41d87))
|
41
|
+
* **HiUploadField:** rename component HiUploadField ([593f77e](https://gitlab.hipay.org/backend/hipay-material-ui/commit/593f77e))
|
42
|
+
* **notice:** Création notice KPI ([bba3f89](https://gitlab.hipay.org/backend/hipay-material-ui/commit/bba3f89))
|
43
|
+
|
44
|
+
|
45
|
+
### Performance Improvements
|
46
|
+
|
47
|
+
* **PureFunction:** Use pure & functional components ([220c686](https://gitlab.hipay.org/backend/hipay-material-ui/commit/220c686))
|
48
|
+
|
49
|
+
|
50
|
+
### BREAKING CHANGES
|
51
|
+
|
52
|
+
* **HiDatePicker:** Required "local" props (use polyglot, p.currentLocal)
|
53
|
+
* **HiUploadField:** Components names changes
|
54
|
+
* **HiCells:** Remove CellCountry, CellThirdParty, CellStatus & CellAccount (use generic type
|
55
|
+
CellImage & CellText)
|
56
|
+
* **HiSelect:** HiSelect API change, use HiNestedSelect or HiDynamicSelect relative to situation
|
57
|
+
|
58
|
+
|
59
|
+
|
1
60
|
# [2.0.0-beta.58](https://gitlab.hipay.org/backend/hipay-material-ui/compare/0.0.1...2.0.0-beta.58) (2018-12-13)
|
2
61
|
|
3
62
|
|
@@ -27,7 +27,7 @@ var _colorManipulator = require("../styles/colorManipulator");
|
|
27
27
|
|
28
28
|
var styles = function styles(theme) {
|
29
29
|
return {
|
30
|
-
root:
|
30
|
+
root: {
|
31
31
|
display: 'inline-block',
|
32
32
|
alignItems: 'baseline',
|
33
33
|
maxWidth: '100%',
|
@@ -37,7 +37,12 @@ var styles = function styles(theme) {
|
|
37
37
|
overflow: 'hidden',
|
38
38
|
whiteSpace: 'nowrap',
|
39
39
|
lineHeight: 1
|
40
|
-
}
|
40
|
+
},
|
41
|
+
body1: (0, _extends2.default)({}, theme.typography.b1),
|
42
|
+
body2: (0, _extends2.default)({}, theme.typography.b2),
|
43
|
+
body3: (0, _extends2.default)({}, theme.typography.b3),
|
44
|
+
body4: (0, _extends2.default)({}, theme.typography.b4),
|
45
|
+
body5: (0, _extends2.default)({}, theme.typography.b5),
|
41
46
|
color: {
|
42
47
|
fontWeight: 400
|
43
48
|
},
|
@@ -135,6 +140,7 @@ function HiColoredLabel(props) {
|
|
135
140
|
|
136
141
|
var classes = props.classes,
|
137
142
|
className = props.className,
|
143
|
+
fontSize = props.fontSize,
|
138
144
|
label = props.label,
|
139
145
|
color = props.color,
|
140
146
|
active = props.active,
|
@@ -142,11 +148,11 @@ function HiColoredLabel(props) {
|
|
142
148
|
fontWeight = props.fontWeight,
|
143
149
|
style = props.style,
|
144
150
|
theme = props.theme,
|
145
|
-
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
151
|
+
other = (0, _objectWithoutProperties2.default)(props, ["classes", "className", "fontSize", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
146
152
|
var isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
147
153
|
var isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
148
154
|
return _react.default.createElement("div", (0, _extends2.default)({
|
149
|
-
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.outlined, outlined), (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),
|
155
|
+
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.outlined, outlined), (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), (0, _defineProperty2.default)(_classNames, classes.body1, fontSize >= 15), (0, _defineProperty2.default)(_classNames, classes.body2, fontSize === 14), (0, _defineProperty2.default)(_classNames, classes.body3, fontSize === 13), (0, _defineProperty2.default)(_classNames, classes.body4, fontSize === 12), (0, _defineProperty2.default)(_classNames, classes.body5, fontSize <= 11), _classNames), className),
|
150
156
|
style: (0, _extends2.default)({}, style, isHexColor && {
|
151
157
|
backgroundColor: active ? color : (0, _colorManipulator.fade)(color, 0.08),
|
152
158
|
color: active ? theme.palette.getContrastText(color) : color
|
@@ -178,6 +184,11 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
178
184
|
*/
|
179
185
|
color: _propTypes.default.string,
|
180
186
|
|
187
|
+
/**
|
188
|
+
* Taille du text
|
189
|
+
*/
|
190
|
+
fontSize: _propTypes.default.number,
|
191
|
+
|
181
192
|
/**
|
182
193
|
* Graisse du text
|
183
194
|
*/
|
@@ -196,6 +207,7 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
196
207
|
HiColoredLabel.defaultProps = {
|
197
208
|
active: false,
|
198
209
|
color: 'primary',
|
210
|
+
fontSize: 15,
|
199
211
|
outlined: false
|
200
212
|
};
|
201
213
|
|
package/HiForm/HiInput.js
CHANGED
@@ -169,6 +169,13 @@ function (_React$PureComponent) {
|
|
169
169
|
|
170
170
|
(0, _classCallCheck2.default)(this, HiInput);
|
171
171
|
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(HiInput).call(this));
|
172
|
+
|
173
|
+
_this.handleClick = function () {
|
174
|
+
if (_this.props.onClick) {
|
175
|
+
_this.props.onClick();
|
176
|
+
}
|
177
|
+
};
|
178
|
+
|
172
179
|
_this.state = {
|
173
180
|
focused: false
|
174
181
|
};
|
@@ -381,6 +388,7 @@ function (_React$PureComponent) {
|
|
381
388
|
placeholder: placeholder,
|
382
389
|
onFocus: this.handleFocus,
|
383
390
|
onKeyDown: this.props.onKeyDown,
|
391
|
+
onClick: this.handleClick,
|
384
392
|
onBlur: this.handleBlur,
|
385
393
|
inputRef: this.getInputElement,
|
386
394
|
disabled: disabled,
|
@@ -509,6 +517,11 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
509
517
|
*/
|
510
518
|
onChange: _propTypes.default.func,
|
511
519
|
|
520
|
+
/**
|
521
|
+
* Fonction de callback appelée au click dans l'input
|
522
|
+
*/
|
523
|
+
onClick: _propTypes.default.func,
|
524
|
+
|
512
525
|
/**
|
513
526
|
* Fonction de callback appelée au focus du champs
|
514
527
|
*/
|
@@ -205,10 +205,10 @@ function (_React$PureComponent) {
|
|
205
205
|
options: [],
|
206
206
|
focused: false
|
207
207
|
});
|
208
|
-
}
|
209
208
|
|
210
|
-
|
211
|
-
|
209
|
+
if (this.props.onBlurInput) {
|
210
|
+
this.props.onBlurInput(event);
|
211
|
+
}
|
212
212
|
}
|
213
213
|
}
|
214
214
|
}, {
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
6
6
|
value: true
|
7
7
|
});
|
8
|
-
exports.default = exports.styles = void 0;
|
8
|
+
exports.default = exports.styles = exports.filterValue = void 0;
|
9
9
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
11
|
|
@@ -76,6 +76,10 @@ function findFinalItemRecursively(itemList, searchId) {
|
|
76
76
|
});
|
77
77
|
return foundItem;
|
78
78
|
}
|
79
|
+
|
80
|
+
var filterValue = function filterValue(item, searchValue) {
|
81
|
+
return searchValue === '' || (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(searchValue.toLowerCase())) !== -1;
|
82
|
+
};
|
79
83
|
/**
|
80
84
|
* Build item list by settings item props relative to the nested parent/child situation
|
81
85
|
* Reduce the item list to build specified items (displayed, pinned, disabled, selected, indeterminate)
|
@@ -94,6 +98,8 @@ function findFinalItemRecursively(itemList, searchId) {
|
|
94
98
|
*/
|
95
99
|
|
96
100
|
|
101
|
+
exports.filterValue = filterValue;
|
102
|
+
|
97
103
|
function buildFilteredItemList(itemList) {
|
98
104
|
var selectedItemIdList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
99
105
|
var searchValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
@@ -102,15 +108,16 @@ function buildFilteredItemList(itemList) {
|
|
102
108
|
var disabledParent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
103
109
|
var nbChildrenAsInfo = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
104
110
|
var translations = arguments.length > 7 ? arguments[7] : undefined;
|
111
|
+
var filterFunc = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : filterValue;
|
105
112
|
return itemList.reduce(function (_ref, item) {
|
106
113
|
var memoItemList = _ref.l,
|
107
114
|
memoSelected = _ref.s,
|
108
115
|
memoUnselected = _ref.u,
|
109
116
|
memoVisible = _ref.v;
|
110
|
-
var itemVisible =
|
117
|
+
var itemVisible = filterFunc(item, searchValue); // Parent item
|
111
118
|
|
112
119
|
if (item.children) {
|
113
|
-
var _buildFilteredItemLis = buildFilteredItemList(item.children, selectedItemIdList, searchValue, itemVisible, pinnedParent, disabledParent),
|
120
|
+
var _buildFilteredItemLis = buildFilteredItemList(item.children, selectedItemIdList, searchValue, itemVisible, pinnedParent, disabledParent, nbChildrenAsInfo, translations, filterFunc),
|
114
121
|
customizedChildren = _buildFilteredItemLis.l,
|
115
122
|
selected = _buildFilteredItemLis.s,
|
116
123
|
unselected = _buildFilteredItemLis.u,
|
@@ -285,9 +292,10 @@ function (_React$PureComponent) {
|
|
285
292
|
multiple = _this$props2.multiple,
|
286
293
|
nbChildrenAsInfo = _this$props2.nbChildrenAsInfo,
|
287
294
|
pinnedParent = _this$props2.pinnedParent,
|
288
|
-
translations = _this$props2.translations
|
295
|
+
translations = _this$props2.translations,
|
296
|
+
filterFunc = _this$props2.filterFunc; // build item list
|
289
297
|
|
290
|
-
var _buildFilteredItemLis2 = buildFilteredItemList(options, value, search, false, pinnedParent, disabledParent || !multiple, nbChildrenAsInfo, translations),
|
298
|
+
var _buildFilteredItemLis2 = buildFilteredItemList(options, value, search, false, pinnedParent, disabledParent || !multiple, nbChildrenAsInfo, translations, filterFunc),
|
291
299
|
filteredItemList = _buildFilteredItemLis2.l,
|
292
300
|
allSelected = _buildFilteredItemLis2.s,
|
293
301
|
allUnselected = _buildFilteredItemLis2.u,
|
@@ -426,7 +434,8 @@ HiNestedSelect.defaultProps = {
|
|
426
434
|
one_item_selected: '%s item selected',
|
427
435
|
n_children: '%s',
|
428
436
|
one_child: '%s item'
|
429
|
-
}
|
437
|
+
},
|
438
|
+
filterFunc: filterValue
|
430
439
|
};
|
431
440
|
HiNestedSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
432
441
|
/**
|
@@ -444,6 +453,11 @@ HiNestedSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
444
453
|
*/
|
445
454
|
displayAsChip: _propTypes.default.bool,
|
446
455
|
|
456
|
+
/*
|
457
|
+
* Fonction de filtrage custom
|
458
|
+
*/
|
459
|
+
filterFunc: _propTypes.default.func,
|
460
|
+
|
447
461
|
/**
|
448
462
|
* Affiche l'élément 'All'
|
449
463
|
*/
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.getRecursiveFinalItemIdList = getRecursiveFinalItemIdList;
|
9
9
|
exports.findFinalItemRecursively = findFinalItemRecursively;
|
10
|
-
exports.default = void 0;
|
10
|
+
exports.default = exports.filterValue = void 0;
|
11
11
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
13
|
|
@@ -72,6 +72,10 @@ function findFinalItemRecursively(itemList, searchId) {
|
|
72
72
|
});
|
73
73
|
return foundItem;
|
74
74
|
}
|
75
|
+
|
76
|
+
var filterValue = function filterValue(item, searchValue) {
|
77
|
+
return searchValue === '' || (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(searchValue.toLowerCase())) !== -1;
|
78
|
+
};
|
75
79
|
/**
|
76
80
|
* Build item list by settings item props relative to the nested parent/child situation
|
77
81
|
* Reduce the item list to build specified items (displayed, pinned, disabled, selected, indeterminate)
|
@@ -90,6 +94,8 @@ function findFinalItemRecursively(itemList, searchId) {
|
|
90
94
|
*/
|
91
95
|
|
92
96
|
|
97
|
+
exports.filterValue = filterValue;
|
98
|
+
|
93
99
|
function buildFilteredItemList(itemList) {
|
94
100
|
var selectedItemIdList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
95
101
|
var searchValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
@@ -98,15 +104,16 @@ function buildFilteredItemList(itemList) {
|
|
98
104
|
var disabledParent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
99
105
|
var nbChildrenAsInfo = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
100
106
|
var translations = arguments.length > 7 ? arguments[7] : undefined;
|
107
|
+
var filterFunc = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : filterValue;
|
101
108
|
return itemList.reduce(function (_ref, item) {
|
102
109
|
var memoItemList = _ref.l,
|
103
110
|
memoSelected = _ref.s,
|
104
111
|
memoUnselected = _ref.u,
|
105
112
|
memoVisible = _ref.v;
|
106
|
-
var itemVisible =
|
113
|
+
var itemVisible = filterFunc(item, searchValue); // Parent item
|
107
114
|
|
108
115
|
if (item.children) {
|
109
|
-
var _buildFilteredItemLis = buildFilteredItemList(item.children, selectedItemIdList, searchValue, itemVisible, pinnedParent, disabledParent),
|
116
|
+
var _buildFilteredItemLis = buildFilteredItemList(item.children, selectedItemIdList, searchValue, itemVisible, pinnedParent, disabledParent, nbChildrenAsInfo, translations, filterFunc),
|
110
117
|
customizedChildren = _buildFilteredItemLis.l,
|
111
118
|
selected = _buildFilteredItemLis.s,
|
112
119
|
unselected = _buildFilteredItemLis.u,
|
@@ -241,9 +248,10 @@ function (_React$PureComponent) {
|
|
241
248
|
multiple = _this$props2.multiple,
|
242
249
|
nbChildrenAsInfo = _this$props2.nbChildrenAsInfo,
|
243
250
|
pinnedParent = _this$props2.pinnedParent,
|
244
|
-
translations = _this$props2.translations
|
251
|
+
translations = _this$props2.translations,
|
252
|
+
filterFunc = _this$props2.filterFunc; // build item list
|
245
253
|
|
246
|
-
var _buildFilteredItemLis2 = buildFilteredItemList(options, value, search, false, pinnedParent, disabledParent || !multiple, nbChildrenAsInfo, translations),
|
254
|
+
var _buildFilteredItemLis2 = buildFilteredItemList(options, value, search, false, pinnedParent, disabledParent || !multiple, nbChildrenAsInfo, translations, filterFunc),
|
247
255
|
filteredItemList = _buildFilteredItemLis2.l,
|
248
256
|
allSelected = _buildFilteredItemLis2.s,
|
249
257
|
allUnselected = _buildFilteredItemLis2.u,
|
@@ -334,7 +342,8 @@ HiNestedSelectContent.defaultProps = {
|
|
334
342
|
search: 'Search',
|
335
343
|
n_children: '%s',
|
336
344
|
one_child: '%s item'
|
337
|
-
}
|
345
|
+
},
|
346
|
+
filterFunc: filterValue
|
338
347
|
};
|
339
348
|
HiNestedSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
340
349
|
/**
|
@@ -347,6 +356,11 @@ HiNestedSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
347
356
|
*/
|
348
357
|
disabledParent: _propTypes.default.bool,
|
349
358
|
|
359
|
+
/*
|
360
|
+
* Fonction de filtrage custom
|
361
|
+
*/
|
362
|
+
filterFunc: _propTypes.default.func,
|
363
|
+
|
350
364
|
/**
|
351
365
|
* Affiche l'élément 'All'
|
352
366
|
*/
|
package/HiSelectNew/HiSelect.js
CHANGED
@@ -110,6 +110,12 @@ var styles = function styles(theme) {
|
|
110
110
|
}
|
111
111
|
};
|
112
112
|
};
|
113
|
+
|
114
|
+
exports.styles = styles;
|
115
|
+
|
116
|
+
function filterValue(item, search) {
|
117
|
+
return search === '' || (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(search.toLowerCase())) !== -1;
|
118
|
+
}
|
113
119
|
/**
|
114
120
|
*
|
115
121
|
* Utilisé pour tous types de selects dans les formulaires.
|
@@ -126,8 +132,6 @@ var styles = function styles(theme) {
|
|
126
132
|
*/
|
127
133
|
|
128
134
|
|
129
|
-
exports.styles = styles;
|
130
|
-
|
131
135
|
var HiSelect =
|
132
136
|
/*#__PURE__*/
|
133
137
|
function (_React$PureComponent) {
|
@@ -152,7 +156,7 @@ function (_React$PureComponent) {
|
|
152
156
|
hideCheckbox: true,
|
153
157
|
label: 'loading'
|
154
158
|
}] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
|
155
|
-
return
|
159
|
+
return _this.props.filterFunc(item, search);
|
156
160
|
})) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
|
157
161
|
id: '_all',
|
158
162
|
label: _this.props.translations.all
|
@@ -267,20 +271,22 @@ function (_React$PureComponent) {
|
|
267
271
|
};
|
268
272
|
|
269
273
|
_this.focusOnSelectedItem = function (selectedValue) {
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
if (selectedValue && typeof selectedValue === 'string') {
|
275
|
-
item = _this.overlay.getElementsByTagName('li')[selectedValue];
|
276
|
-
} else if (selectedValue && typeof selectedValue === 'number') {
|
277
|
-
item = _this.overlay.getElementsByTagName('li')[selectedValue - 1];
|
278
|
-
}
|
274
|
+
if (_this.overlay && _this.overlay.getElementsByTagName('li')[0]) {
|
275
|
+
setTimeout(function () {
|
276
|
+
// On initialise au premier élément pour être sûr de ne pas se retrouver avec un focus of undefined
|
277
|
+
var item = _this.overlay.getElementsByTagName('li')[0];
|
279
278
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
279
|
+
if (selectedValue && typeof selectedValue === 'string') {
|
280
|
+
item = _this.overlay.getElementsByTagName('li')[selectedValue];
|
281
|
+
} else if (selectedValue && typeof selectedValue === 'number') {
|
282
|
+
item = _this.overlay.getElementsByTagName('li')[selectedValue - 1];
|
283
|
+
}
|
284
|
+
|
285
|
+
if (item) {
|
286
|
+
item.focus();
|
287
|
+
}
|
288
|
+
}, 1);
|
289
|
+
}
|
284
290
|
};
|
285
291
|
|
286
292
|
_this.handleClickAway = function (event) {
|
@@ -751,7 +757,8 @@ HiSelect.defaultProps = {
|
|
751
757
|
n_children: '%s items',
|
752
758
|
one_child: '%s item'
|
753
759
|
},
|
754
|
-
type: 'text'
|
760
|
+
type: 'text',
|
761
|
+
filterFunc: filterValue
|
755
762
|
};
|
756
763
|
HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
757
764
|
align: _propTypes.default.oneOf(['left', 'right']),
|
@@ -786,6 +793,11 @@ HiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
786
793
|
*/
|
787
794
|
fallbackImage: _propTypes.default.string,
|
788
795
|
|
796
|
+
/*
|
797
|
+
* Fonction de filtrage custom
|
798
|
+
*/
|
799
|
+
filterFunc: _propTypes.default.func,
|
800
|
+
|
789
801
|
/**
|
790
802
|
* Affiche l'élément 'All'
|
791
803
|
*/
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
6
6
|
value: true
|
7
7
|
});
|
8
|
-
exports.default = exports.styles = void 0;
|
8
|
+
exports.default = exports.filterValue = exports.styles = void 0;
|
9
9
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11
11
|
|
@@ -70,6 +70,12 @@ var styles = function styles(theme) {
|
|
70
70
|
})
|
71
71
|
};
|
72
72
|
};
|
73
|
+
|
74
|
+
exports.styles = styles;
|
75
|
+
|
76
|
+
var filterValue = function filterValue(item, searchValue) {
|
77
|
+
return searchValue === '' || (0, _helpers.foldAccents)(item.label.toString().toLowerCase()).search((0, _helpers.foldAccents)(searchValue.toLowerCase())) !== -1;
|
78
|
+
};
|
73
79
|
/**
|
74
80
|
*
|
75
81
|
* Utilisé pour tous types de selects dans les formulaires.
|
@@ -86,7 +92,7 @@ var styles = function styles(theme) {
|
|
86
92
|
*/
|
87
93
|
|
88
94
|
|
89
|
-
exports.
|
95
|
+
exports.filterValue = filterValue;
|
90
96
|
|
91
97
|
var HiSelectContent =
|
92
98
|
/*#__PURE__*/
|
@@ -253,7 +259,7 @@ function (_React$PureComponent) {
|
|
253
259
|
hideCheckbox: true,
|
254
260
|
label: 'loading'
|
255
261
|
}] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
|
256
|
-
return item.label &&
|
262
|
+
return item.label && _this.props.filterFunc(item, search);
|
257
263
|
})) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
|
258
264
|
id: '_all',
|
259
265
|
label: _this.props.translations.all
|
@@ -395,7 +401,8 @@ HiSelectContent.defaultProps = {
|
|
395
401
|
n_children: '%s items',
|
396
402
|
one_child: '%s item'
|
397
403
|
},
|
398
|
-
type: 'text'
|
404
|
+
type: 'text',
|
405
|
+
filterFunc: filterValue
|
399
406
|
};
|
400
407
|
HiSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
401
408
|
autoHeight: _propTypes.default.bool,
|
@@ -420,6 +427,11 @@ HiSelectContent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
420
427
|
*/
|
421
428
|
fallbackImage: _propTypes.default.string,
|
422
429
|
|
430
|
+
/*
|
431
|
+
* Fonction de filtrage custom
|
432
|
+
*/
|
433
|
+
filterFunc: _propTypes.default.func,
|
434
|
+
|
423
435
|
/**
|
424
436
|
* Affiche l'élément 'All'
|
425
437
|
*/
|
@@ -172,8 +172,6 @@ function (_React$PureComponent) {
|
|
172
172
|
|
173
173
|
if (_this.props.onKeyDown) {
|
174
174
|
_this.props.onKeyDown(event);
|
175
|
-
|
176
|
-
event.preventDefault();
|
177
175
|
} else if (key === 'down' || key === 'up') {
|
178
176
|
_this.props.onClick();
|
179
177
|
} else if (key === 'enter' && _this.props.onSubmit) {
|
@@ -215,9 +213,11 @@ function (_React$PureComponent) {
|
|
215
213
|
_this.handleBlur = function (event) {
|
216
214
|
if ((!_this.input || !_this.input.contains(event.relatedTarget)) && _this.props.onBlur) {
|
217
215
|
_this.props.onBlur(event);
|
218
|
-
} else if (_this.input && (!_this.resetIcon || !_this.resetIcon.contains(event.relatedTarget))) {
|
219
|
-
_this.input.focus();
|
220
216
|
}
|
217
|
+
/* else if (this.input && (!this.resetIcon || !this.resetIcon.contains(event.relatedTarget))) {
|
218
|
+
this.input.focus();
|
219
|
+
}*/
|
220
|
+
|
221
221
|
};
|
222
222
|
|
223
223
|
_this.ref = function (el) {
|
@@ -122,12 +122,13 @@ var styles = function styles(theme) {
|
|
122
122
|
minWidth: '50%',
|
123
123
|
padding: '5px 0',
|
124
124
|
'&$listItemContentSelected': {
|
125
|
-
marginBottom:
|
125
|
+
marginBottom: 1,
|
126
126
|
marginLeft: -4
|
127
127
|
},
|
128
128
|
'& strong': {
|
129
129
|
fontWeight: theme.typography.fontWeightMedium
|
130
|
-
}
|
130
|
+
},
|
131
|
+
display: 'inline-flex'
|
131
132
|
}),
|
132
133
|
listItemContentSelected: {},
|
133
134
|
label: {
|
@@ -173,7 +174,7 @@ var styles = function styles(theme) {
|
|
173
174
|
labelContent: {
|
174
175
|
display: 'flex',
|
175
176
|
alignItems: 'center',
|
176
|
-
maxWidth: '
|
177
|
+
maxWidth: '85%',
|
177
178
|
'&$labelWithoutSecondaryInline': {
|
178
179
|
maxWidth: '100%'
|
179
180
|
}
|
@@ -278,7 +279,8 @@ function (_React$PureComponent) {
|
|
278
279
|
}
|
279
280
|
|
280
281
|
return _react.default.createElement("div", {
|
281
|
-
className: classes.label
|
282
|
+
className: classes.label,
|
283
|
+
title: label
|
282
284
|
}, label);
|
283
285
|
}
|
284
286
|
}, {
|
@@ -8,7 +8,7 @@ import withStyles from '../styles/withStyles';
|
|
8
8
|
import { capitalize } from '../utils/helpers';
|
9
9
|
import { fade } from '../styles/colorManipulator';
|
10
10
|
export const styles = theme => ({
|
11
|
-
root:
|
11
|
+
root: {
|
12
12
|
display: 'inline-block',
|
13
13
|
alignItems: 'baseline',
|
14
14
|
maxWidth: '100%',
|
@@ -18,7 +18,12 @@ export const styles = theme => ({
|
|
18
18
|
overflow: 'hidden',
|
19
19
|
whiteSpace: 'nowrap',
|
20
20
|
lineHeight: 1
|
21
|
-
}
|
21
|
+
},
|
22
|
+
body1: _objectSpread({}, theme.typography.b1),
|
23
|
+
body2: _objectSpread({}, theme.typography.b2),
|
24
|
+
body3: _objectSpread({}, theme.typography.b3),
|
25
|
+
body4: _objectSpread({}, theme.typography.b4),
|
26
|
+
body5: _objectSpread({}, theme.typography.b5),
|
22
27
|
color: {
|
23
28
|
fontWeight: 400
|
24
29
|
},
|
@@ -111,6 +116,7 @@ function HiColoredLabel(props) {
|
|
111
116
|
const {
|
112
117
|
classes,
|
113
118
|
className,
|
119
|
+
fontSize,
|
114
120
|
label,
|
115
121
|
color,
|
116
122
|
active,
|
@@ -119,7 +125,7 @@ function HiColoredLabel(props) {
|
|
119
125
|
style,
|
120
126
|
theme
|
121
127
|
} = props,
|
122
|
-
other = _objectWithoutProperties(props, ["classes", "className", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
128
|
+
other = _objectWithoutProperties(props, ["classes", "className", "fontSize", "label", "color", "active", "outlined", "fontWeight", "style", "theme"]);
|
123
129
|
|
124
130
|
const isHiColor = ['primary', 'secondary', 'positive', 'negative', 'middle', 'neutral'].includes(color);
|
125
131
|
const isHexColor = !isHiColor && /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
|
@@ -129,7 +135,12 @@ function HiColoredLabel(props) {
|
|
129
135
|
[classes.activeColor]: active,
|
130
136
|
[classes.outlined]: outlined,
|
131
137
|
[classes[`activeColor${capitalize(color)}`]]: active && isHiColor,
|
132
|
-
[classes[`color${capitalize(color)}`]]: !active && isHiColor
|
138
|
+
[classes[`color${capitalize(color)}`]]: !active && isHiColor,
|
139
|
+
[classes.body1]: fontSize >= 15,
|
140
|
+
[classes.body2]: fontSize === 14,
|
141
|
+
[classes.body3]: fontSize === 13,
|
142
|
+
[classes.body4]: fontSize === 12,
|
143
|
+
[classes.body5]: fontSize <= 11
|
133
144
|
}, className),
|
134
145
|
style: _objectSpread({}, style, isHexColor && {
|
135
146
|
backgroundColor: active ? color : fade(color, 0.08),
|
@@ -162,6 +173,11 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
162
173
|
*/
|
163
174
|
color: PropTypes.string,
|
164
175
|
|
176
|
+
/**
|
177
|
+
* Taille du text
|
178
|
+
*/
|
179
|
+
fontSize: PropTypes.number,
|
180
|
+
|
165
181
|
/**
|
166
182
|
* Graisse du text
|
167
183
|
*/
|
@@ -180,6 +196,7 @@ HiColoredLabel.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
180
196
|
HiColoredLabel.defaultProps = {
|
181
197
|
active: false,
|
182
198
|
color: 'primary',
|
199
|
+
fontSize: 15,
|
183
200
|
outlined: false
|
184
201
|
};
|
185
202
|
export default withStyles(styles, {
|
package/es/HiForm/HiInput.js
CHANGED
@@ -127,6 +127,13 @@ var _ref = React.createElement(HiIcon, {
|
|
127
127
|
class HiInput extends React.PureComponent {
|
128
128
|
constructor() {
|
129
129
|
super();
|
130
|
+
|
131
|
+
this.handleClick = () => {
|
132
|
+
if (this.props.onClick) {
|
133
|
+
this.props.onClick();
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
130
137
|
this.state = {
|
131
138
|
focused: false
|
132
139
|
};
|
@@ -347,6 +354,7 @@ class HiInput extends React.PureComponent {
|
|
347
354
|
placeholder: placeholder,
|
348
355
|
onFocus: this.handleFocus,
|
349
356
|
onKeyDown: this.props.onKeyDown,
|
357
|
+
onClick: this.handleClick,
|
350
358
|
onBlur: this.handleBlur,
|
351
359
|
inputRef: this.getInputElement,
|
352
360
|
disabled: disabled,
|
@@ -466,6 +474,11 @@ HiInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
466
474
|
*/
|
467
475
|
onChange: PropTypes.func,
|
468
476
|
|
477
|
+
/**
|
478
|
+
* Fonction de callback appelée au click dans l'input
|
479
|
+
*/
|
480
|
+
onClick: PropTypes.func,
|
481
|
+
|
469
482
|
/**
|
470
483
|
* Fonction de callback appelée au focus du champs
|
471
484
|
*/
|