@hipay/hipay-material-ui 2.0.0-beta.64 → 2.0.0-beta.65
Sign up to get free protection for your applications and to get access to all the features.
- package/HiCell/CellRate.js +1 -1
- package/HiSelect/HiDynamicSelect.js +4 -6
- package/HiSelect/HiNestedSelect.js +9 -9
- package/HiSelect/HiNestedSelectContent.js +9 -9
- package/HiSelect/HiSelect.js +7 -7
- package/HiSelect/HiSelectContent.js +7 -7
- package/HiSelectableList/HiSelectableList.js +27 -13
- package/es/HiCell/CellRate.js +1 -1
- package/es/HiSelect/HiDynamicSelect.js +1 -3
- package/es/HiSelectableList/HiSelectableList.js +22 -8
- package/index.es.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -2
- package/umd/hipay-material-ui.development.js +38696 -40726
- package/umd/hipay-material-ui.production.min.js +2 -2
package/HiCell/CellRate.js
CHANGED
@@ -80,7 +80,7 @@ function (_React$PureComponent) {
|
|
80
80
|
return id !== item.id;
|
81
81
|
}), item);
|
82
82
|
} else {
|
83
|
-
onChange(event,
|
83
|
+
onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
|
84
84
|
}
|
85
85
|
};
|
86
86
|
|
@@ -91,14 +91,14 @@ function (_React$PureComponent) {
|
|
91
91
|
var _this$props2 = _this.props,
|
92
92
|
nextPage = _this$props2.nextPage,
|
93
93
|
translations = _this$props2.translations;
|
94
|
-
var itemList =
|
94
|
+
var itemList = (0, _toConsumableArray2.default)(options.length === 0 && !loading ? [{
|
95
95
|
id: '_no_result',
|
96
96
|
type: 'text',
|
97
97
|
disabled: true,
|
98
98
|
centered: true,
|
99
99
|
hideCheckbox: true,
|
100
100
|
label: translations.no_result_match
|
101
|
-
}] : [])
|
101
|
+
}] : []).concat((0, _toConsumableArray2.default)(options), (0, _toConsumableArray2.default)(!loading && nextPage === 'manual' ? [{
|
102
102
|
id: '_next_page',
|
103
103
|
type: 'button',
|
104
104
|
centered: true,
|
@@ -135,9 +135,7 @@ function (_React$PureComponent) {
|
|
135
135
|
other = (0, _objectWithoutProperties2.default)(_this$props3, ["hiSelectableListProps", "multiple", "nextPage", "options", "translations", "value"]);
|
136
136
|
return _react.default.createElement(_HiSelect.default, (0, _extends2.default)({
|
137
137
|
buildSelectProps: this.buildSelectProps,
|
138
|
-
hiSelectableListProps: (0, _extends2.default)({
|
139
|
-
onSelect: this.handleSelect
|
140
|
-
}, hiSelectableListProps),
|
138
|
+
hiSelectableListProps: (0, _extends2.default)({}, hiSelectableListProps),
|
141
139
|
multiple: multiple,
|
142
140
|
options: options,
|
143
141
|
searchable: true,
|
@@ -47,12 +47,12 @@ var _helpers = require("../utils/helpers");
|
|
47
47
|
*/
|
48
48
|
function getRecursiveFinalItemIdList(itemList) {
|
49
49
|
var finalItemIdList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
50
|
-
return
|
50
|
+
return (0, _toConsumableArray2.default)(finalItemIdList).concat((0, _toConsumableArray2.default)(itemList.reduce(function (memo, item) {
|
51
51
|
if (item.children) {
|
52
52
|
return getRecursiveFinalItemIdList(item.children, memo);
|
53
53
|
}
|
54
54
|
|
55
|
-
return
|
55
|
+
return (0, _toConsumableArray2.default)(memo).concat([item.id]);
|
56
56
|
}, [])));
|
57
57
|
}
|
58
58
|
/**
|
@@ -128,7 +128,7 @@ function buildFilteredItemList(itemList) {
|
|
128
128
|
}
|
129
129
|
|
130
130
|
return {
|
131
|
-
l:
|
131
|
+
l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({}, item, disabledParent && {
|
132
132
|
disabled: true,
|
133
133
|
hideCheckbox: true // don't display checkbox on disabled parent
|
134
134
|
|
@@ -147,7 +147,7 @@ function buildFilteredItemList(itemList) {
|
|
147
147
|
|
148
148
|
var itemSelected = selectedItemIdList.includes(item.id);
|
149
149
|
return {
|
150
|
-
l:
|
150
|
+
l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({
|
151
151
|
displayed: itemVisible || visibleParent
|
152
152
|
}, item)]),
|
153
153
|
s: itemSelected && memoSelected,
|
@@ -266,9 +266,9 @@ function (_React$PureComponent) {
|
|
266
266
|
}), item);
|
267
267
|
} else {
|
268
268
|
// select parent > add each selectable child without duplicates.
|
269
|
-
onChange(event,
|
269
|
+
onChange(event, (0, _toConsumableArray2.default)(value.filter(function (vid) {
|
270
270
|
return !parentSelectableItemIdList.includes(vid);
|
271
|
-
}))
|
271
|
+
})).concat((0, _toConsumableArray2.default)(parentSelectableItemIdList)), item);
|
272
272
|
}
|
273
273
|
} else if (value.includes(item.id)) {
|
274
274
|
// unselect item
|
@@ -276,7 +276,7 @@ function (_React$PureComponent) {
|
|
276
276
|
return id !== item.id;
|
277
277
|
}), item);
|
278
278
|
} else {
|
279
|
-
onChange(event,
|
279
|
+
onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
|
280
280
|
}
|
281
281
|
};
|
282
282
|
|
@@ -315,14 +315,14 @@ function (_React$PureComponent) {
|
|
315
315
|
centered: true,
|
316
316
|
hideCheckbox: true,
|
317
317
|
label: translations.no_result_match
|
318
|
-
}]) :
|
318
|
+
}]) : (0, _toConsumableArray2.default)(loading ? [{
|
319
319
|
id: '_loading',
|
320
320
|
type: 'loader',
|
321
321
|
disabled: true,
|
322
322
|
centered: true,
|
323
323
|
hideCheckbox: true,
|
324
324
|
label: 'loading'
|
325
|
-
}] : [])
|
325
|
+
}] : []).concat((0, _toConsumableArray2.default)(hasAll ? [{
|
326
326
|
id: '_all',
|
327
327
|
iconAll: iconAll,
|
328
328
|
label: translations.all,
|
@@ -43,12 +43,12 @@ var _helpers = require("../utils/helpers");
|
|
43
43
|
*/
|
44
44
|
function getRecursiveFinalItemIdList(itemList) {
|
45
45
|
var finalItemIdList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
46
|
-
return
|
46
|
+
return (0, _toConsumableArray2.default)(finalItemIdList).concat((0, _toConsumableArray2.default)(itemList.reduce(function (memo, item) {
|
47
47
|
if (item.children) {
|
48
48
|
return getRecursiveFinalItemIdList(item.children, memo);
|
49
49
|
}
|
50
50
|
|
51
|
-
return
|
51
|
+
return (0, _toConsumableArray2.default)(memo).concat([item.id]);
|
52
52
|
}, [])));
|
53
53
|
}
|
54
54
|
/**
|
@@ -124,7 +124,7 @@ function buildFilteredItemList(itemList) {
|
|
124
124
|
}
|
125
125
|
|
126
126
|
return {
|
127
|
-
l:
|
127
|
+
l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({}, item, disabledParent && {
|
128
128
|
disabled: true,
|
129
129
|
hideCheckbox: true // don't display checkbox on disabled parent
|
130
130
|
|
@@ -143,7 +143,7 @@ function buildFilteredItemList(itemList) {
|
|
143
143
|
|
144
144
|
var itemSelected = selectedItemIdList.includes(item.id);
|
145
145
|
return {
|
146
|
-
l:
|
146
|
+
l: (0, _toConsumableArray2.default)(memoItemList).concat([(0, _extends2.default)({
|
147
147
|
displayed: itemVisible || visibleParent
|
148
148
|
}, item)]),
|
149
149
|
s: itemSelected && memoSelected,
|
@@ -223,9 +223,9 @@ function (_React$PureComponent) {
|
|
223
223
|
}), item);
|
224
224
|
} else {
|
225
225
|
// select parent > add each selectable child without duplicates.
|
226
|
-
onChange(event,
|
226
|
+
onChange(event, (0, _toConsumableArray2.default)(value.filter(function (vid) {
|
227
227
|
return !parentSelectableItemIdList.includes(vid);
|
228
|
-
}))
|
228
|
+
})).concat((0, _toConsumableArray2.default)(parentSelectableItemIdList)), item);
|
229
229
|
}
|
230
230
|
} else if (value.includes(item.id)) {
|
231
231
|
// unselect item
|
@@ -233,7 +233,7 @@ function (_React$PureComponent) {
|
|
233
233
|
return id !== item.id;
|
234
234
|
}), item);
|
235
235
|
} else {
|
236
|
-
onChange(event,
|
236
|
+
onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
|
237
237
|
}
|
238
238
|
};
|
239
239
|
|
@@ -271,14 +271,14 @@ function (_React$PureComponent) {
|
|
271
271
|
centered: true,
|
272
272
|
hideCheckbox: true,
|
273
273
|
label: translations.no_result_match
|
274
|
-
}]) :
|
274
|
+
}]) : (0, _toConsumableArray2.default)(loading ? [{
|
275
275
|
id: '_loading',
|
276
276
|
type: 'loader',
|
277
277
|
disabled: true,
|
278
278
|
centered: true,
|
279
279
|
hideCheckbox: true,
|
280
280
|
label: 'loading'
|
281
|
-
}] : [])
|
281
|
+
}] : []).concat((0, _toConsumableArray2.default)(hasAll ? [{
|
282
282
|
id: '_all',
|
283
283
|
iconAll: iconAll,
|
284
284
|
label: translations.all,
|
package/HiSelect/HiSelect.js
CHANGED
@@ -149,22 +149,22 @@ function (_React$PureComponent) {
|
|
149
149
|
var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
150
150
|
var loading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
151
151
|
// build item list
|
152
|
-
var itemList =
|
152
|
+
var itemList = (0, _toConsumableArray2.default)(loading ? [{
|
153
153
|
id: '_loading',
|
154
154
|
type: 'loader',
|
155
155
|
disabled: true,
|
156
156
|
centered: true,
|
157
157
|
hideCheckbox: true,
|
158
158
|
label: 'loading'
|
159
|
-
}] : [])
|
159
|
+
}] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
|
160
160
|
return _this.props.filterFunc(item, search);
|
161
|
-
})) :
|
161
|
+
})) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
|
162
162
|
id: '_all',
|
163
163
|
label: _this.props.translations.all
|
164
164
|
}, _this.props.iconAll && {
|
165
165
|
type: 'icon',
|
166
166
|
icon: _this.props.iconAll
|
167
|
-
})] : [])
|
167
|
+
})] : []).concat((0, _toConsumableArray2.default)(options))));
|
168
168
|
return {
|
169
169
|
itemList: itemList,
|
170
170
|
inputValue: _this.buildInputValue(options, value, loading)
|
@@ -420,7 +420,7 @@ function (_React$PureComponent) {
|
|
420
420
|
return id !== item.id;
|
421
421
|
}), item);
|
422
422
|
} else {
|
423
|
-
onChange(event,
|
423
|
+
onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
|
424
424
|
}
|
425
425
|
};
|
426
426
|
|
@@ -446,13 +446,13 @@ function (_React$PureComponent) {
|
|
446
446
|
});
|
447
447
|
} else {
|
448
448
|
_this.setState({
|
449
|
-
suggestions:
|
449
|
+
suggestions: (0, _toConsumableArray2.default)(hasAll ? [(0, _extends2.default)({
|
450
450
|
id: '_all',
|
451
451
|
label: translations.all
|
452
452
|
}, iconAll && {
|
453
453
|
type: 'icon',
|
454
454
|
icon: iconAll
|
455
|
-
})] : [])
|
455
|
+
})] : []).concat((0, _toConsumableArray2.default)(suggestions))
|
456
456
|
});
|
457
457
|
}
|
458
458
|
};
|
@@ -179,7 +179,7 @@ function (_React$PureComponent) {
|
|
179
179
|
return id !== item.id;
|
180
180
|
}), item);
|
181
181
|
} else {
|
182
|
-
onChange(event,
|
182
|
+
onChange(event, (0, _toConsumableArray2.default)(value).concat([item.id]), item);
|
183
183
|
}
|
184
184
|
};
|
185
185
|
|
@@ -209,13 +209,13 @@ function (_React$PureComponent) {
|
|
209
209
|
});
|
210
210
|
} else {
|
211
211
|
_this.setState({
|
212
|
-
suggestions:
|
212
|
+
suggestions: (0, _toConsumableArray2.default)(hasAll ? [(0, _extends2.default)({
|
213
213
|
id: '_all',
|
214
214
|
label: translations.all
|
215
215
|
}, iconAll && {
|
216
216
|
type: 'icon',
|
217
217
|
icon: iconAll
|
218
|
-
})] : [])
|
218
|
+
})] : []).concat((0, _toConsumableArray2.default)(suggestions))
|
219
219
|
});
|
220
220
|
}
|
221
221
|
};
|
@@ -251,22 +251,22 @@ function (_React$PureComponent) {
|
|
251
251
|
var search = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
252
252
|
var loading = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
253
253
|
// build item list
|
254
|
-
var itemList =
|
254
|
+
var itemList = (0, _toConsumableArray2.default)(loading ? [{
|
255
255
|
id: '_loading',
|
256
256
|
type: 'loader',
|
257
257
|
disabled: true,
|
258
258
|
centered: true,
|
259
259
|
hideCheckbox: true,
|
260
260
|
label: 'loading'
|
261
|
-
}] : [])
|
261
|
+
}] : []).concat((0, _toConsumableArray2.default)(search !== '' ? (0, _toConsumableArray2.default)(options.filter(function (item) {
|
262
262
|
return item.label && _this.props.filterFunc(item, search);
|
263
|
-
})) :
|
263
|
+
})) : (0, _toConsumableArray2.default)(_this.props.hasAll ? [(0, _extends2.default)({
|
264
264
|
id: '_all',
|
265
265
|
label: _this.props.translations.all
|
266
266
|
}, _this.props.iconAll && {
|
267
267
|
type: 'icon',
|
268
268
|
icon: _this.props.iconAll
|
269
|
-
})] : [])
|
269
|
+
})] : []).concat((0, _toConsumableArray2.default)(options))));
|
270
270
|
return {
|
271
271
|
itemList: itemList
|
272
272
|
};
|
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.default = exports.styles = void 0;
|
9
9
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
11
|
-
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
11
|
|
14
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
@@ -163,16 +161,32 @@ function (_React$PureComponent) {
|
|
163
161
|
(0, _createClass2.default)(HiSelectableList, [{
|
164
162
|
key: "componentDidMount",
|
165
163
|
value: function componentDidMount() {
|
164
|
+
var _this2 = this;
|
165
|
+
|
166
|
+
// Focus on last item selected
|
166
167
|
if (this.props.overlay && this.props.overlay.getElementsByTagName('li')[0]) {
|
167
168
|
var item = this.props.overlay.getElementsByTagName('li')[0];
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
169
|
+
|
170
|
+
if (this.props.value) {
|
171
|
+
var lastSelectedValue = Array.isArray(this.props.value) ? this.props.value[this.props.value.length - 1] : this.props.value;
|
172
|
+
var index = 0;
|
173
|
+
this.props.itemList.forEach(function (option) {
|
174
|
+
if (option.id === lastSelectedValue) {
|
175
|
+
item = _this2.props.overlay.getElementsByTagName('li')[index];
|
176
|
+
}
|
177
|
+
|
178
|
+
index++;
|
179
|
+
|
180
|
+
if (option.children && option.children.length) {
|
181
|
+
option.children.forEach(function (option) {
|
182
|
+
if (option.id === lastSelectedValue) {
|
183
|
+
item = _this2.props.overlay.getElementsByTagName('li')[index];
|
184
|
+
}
|
185
|
+
|
186
|
+
index++;
|
187
|
+
});
|
188
|
+
}
|
189
|
+
});
|
176
190
|
}
|
177
191
|
|
178
192
|
item.focus();
|
@@ -181,7 +195,7 @@ function (_React$PureComponent) {
|
|
181
195
|
}, {
|
182
196
|
key: "render",
|
183
197
|
value: function render() {
|
184
|
-
var
|
198
|
+
var _this3 = this;
|
185
199
|
|
186
200
|
var _this$props2 = this.props,
|
187
201
|
classes = _this$props2.classes,
|
@@ -196,13 +210,13 @@ function (_React$PureComponent) {
|
|
196
210
|
className: classes.root,
|
197
211
|
onKeyDown: this.handleKeyDown,
|
198
212
|
innerRef: function innerRef(el) {
|
199
|
-
|
213
|
+
_this3.el = el;
|
200
214
|
}
|
201
215
|
}, itemList.filter(function (item) {
|
202
216
|
return !(item.displayed === false);
|
203
217
|
}) // don't remove if undefined
|
204
218
|
.map(function (item) {
|
205
|
-
return
|
219
|
+
return _this3.buildRecursiveListItem(item);
|
206
220
|
}));
|
207
221
|
}
|
208
222
|
}]);
|
package/es/HiCell/CellRate.js
CHANGED
@@ -102,9 +102,7 @@ class HiDynamicSelect extends React.PureComponent {
|
|
102
102
|
|
103
103
|
return React.createElement(HiSelect, _extends({
|
104
104
|
buildSelectProps: this.buildSelectProps,
|
105
|
-
hiSelectableListProps: _objectSpread({
|
106
|
-
onSelect: this.handleSelect
|
107
|
-
}, hiSelectableListProps),
|
105
|
+
hiSelectableListProps: _objectSpread({}, hiSelectableListProps),
|
108
106
|
multiple: multiple,
|
109
107
|
options: options,
|
110
108
|
searchable: true,
|
@@ -105,16 +105,30 @@ class HiSelectableList extends React.PureComponent {
|
|
105
105
|
}
|
106
106
|
|
107
107
|
componentDidMount() {
|
108
|
+
// Focus on last item selected
|
108
109
|
if (this.props.overlay && this.props.overlay.getElementsByTagName('li')[0]) {
|
109
110
|
let item = this.props.overlay.getElementsByTagName('li')[0];
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
111
|
+
|
112
|
+
if (this.props.value) {
|
113
|
+
let lastSelectedValue = Array.isArray(this.props.value) ? this.props.value[this.props.value.length - 1] : this.props.value;
|
114
|
+
let index = 0;
|
115
|
+
this.props.itemList.forEach(option => {
|
116
|
+
if (option.id === lastSelectedValue) {
|
117
|
+
item = this.props.overlay.getElementsByTagName('li')[index];
|
118
|
+
}
|
119
|
+
|
120
|
+
index++;
|
121
|
+
|
122
|
+
if (option.children && option.children.length) {
|
123
|
+
option.children.forEach(option => {
|
124
|
+
if (option.id === lastSelectedValue) {
|
125
|
+
item = this.props.overlay.getElementsByTagName('li')[index];
|
126
|
+
}
|
127
|
+
|
128
|
+
index++;
|
129
|
+
});
|
130
|
+
}
|
131
|
+
});
|
118
132
|
}
|
119
133
|
|
120
134
|
item.focus();
|
package/index.es.js
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED