@zohodesk/components 1.4.8 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli/propValidation_report.html +1 -1
- package/README.md +6 -0
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +16 -8
- package/es/MultiSelect/AdvancedMultiSelect.js +13 -6
- package/es/MultiSelect/EmptyState.js +2 -1
- package/es/MultiSelect/MultiSelect.js +26 -15
- package/es/MultiSelect/MultiSelectWithAvatar.js +9 -2
- package/es/MultiSelect/SelectedOptions.js +4 -2
- package/es/MultiSelect/Suggestions.js +10 -2
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/es/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/es/MultiSelect/constants.js +6 -0
- package/es/MultiSelect/props/propTypes.js +15 -55
- package/es/utils/dropDownUtils.js +25 -6
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +94 -83
- package/lib/MultiSelect/AdvancedMultiSelect.js +16 -7
- package/lib/MultiSelect/EmptyState.js +3 -1
- package/lib/MultiSelect/MultiSelect.js +28 -15
- package/lib/MultiSelect/MultiSelectWithAvatar.js +11 -3
- package/lib/MultiSelect/SelectedOptions.js +4 -2
- package/lib/MultiSelect/Suggestions.js +10 -2
- package/lib/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
- package/lib/MultiSelect/__tests__/Suggestions.spec.js +58 -0
- package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
- package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
- package/lib/MultiSelect/constants.js +13 -0
- package/lib/MultiSelect/props/propTypes.js +14 -55
- package/lib/utils/dropDownUtils.js +24 -3
- package/package.json +7 -6
|
@@ -37,11 +37,13 @@ export const MultiSelect_propTypes = {
|
|
|
37
37
|
getRef: PropTypes.func,
|
|
38
38
|
getTargetRef: PropTypes.func,
|
|
39
39
|
i18nKeys: PropTypes.shape({
|
|
40
|
+
searchText: PropTypes.string,
|
|
40
41
|
clearText: PropTypes.string,
|
|
41
42
|
loadingText: PropTypes.string,
|
|
42
43
|
emptyText: PropTypes.string,
|
|
43
44
|
noMoreText: PropTypes.string,
|
|
44
|
-
searchEmptyText: PropTypes.string
|
|
45
|
+
searchEmptyText: PropTypes.string,
|
|
46
|
+
limitReachedMessage: PropTypes.string
|
|
45
47
|
}),
|
|
46
48
|
a11y: PropTypes.shape({
|
|
47
49
|
clearLabel: PropTypes.string
|
|
@@ -116,7 +118,8 @@ export const MultiSelect_propTypes = {
|
|
|
116
118
|
isFocus: PropTypes.bool,
|
|
117
119
|
allowValueFallback: PropTypes.bool,
|
|
118
120
|
renderCustomClearComponent: PropTypes.func,
|
|
119
|
-
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
|
|
121
|
+
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
122
|
+
limit: PropTypes.number
|
|
120
123
|
};
|
|
121
124
|
export const MultiSelectHeader_propTypes = {
|
|
122
125
|
dataId: PropTypes.string,
|
|
@@ -153,7 +156,8 @@ export const SelectedOptions_propTypes = {
|
|
|
153
156
|
})),
|
|
154
157
|
size: PropTypes.oneOf(['medium', 'xmedium']),
|
|
155
158
|
palette: PropTypes.string,
|
|
156
|
-
dataId: PropTypes.string
|
|
159
|
+
dataId: PropTypes.string,
|
|
160
|
+
limit: PropTypes.number
|
|
157
161
|
};
|
|
158
162
|
export const Suggestions_propTypes = {
|
|
159
163
|
a11y: PropTypes.shape({
|
|
@@ -183,7 +187,9 @@ export const Suggestions_propTypes = {
|
|
|
183
187
|
logo: PropTypes.string,
|
|
184
188
|
optionType: PropTypes.string,
|
|
185
189
|
listItemProps: PropTypes.object
|
|
186
|
-
}))
|
|
190
|
+
})),
|
|
191
|
+
limit: PropTypes.number,
|
|
192
|
+
limitReachedMessage: PropTypes.string
|
|
187
193
|
};
|
|
188
194
|
export const AdvancedGroupMultiSelect_propTypes = {
|
|
189
195
|
animationStyle: PropTypes.string,
|
|
@@ -201,7 +207,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
201
207
|
loadingText: PropTypes.string,
|
|
202
208
|
emptyText: PropTypes.string,
|
|
203
209
|
noMoreText: PropTypes.string,
|
|
204
|
-
searchEmptyText: PropTypes.string
|
|
210
|
+
searchEmptyText: PropTypes.string,
|
|
211
|
+
limitReachedMessage: PropTypes.string
|
|
205
212
|
}),
|
|
206
213
|
a11y: PropTypes.shape({
|
|
207
214
|
clearLabel: PropTypes.string
|
|
@@ -255,7 +262,8 @@ export const AdvancedGroupMultiSelect_propTypes = {
|
|
|
255
262
|
children: PropTypes.node,
|
|
256
263
|
dataSelectorId: PropTypes.string,
|
|
257
264
|
isFocus: PropTypes.bool,
|
|
258
|
-
allowValueFallback: PropTypes.bool
|
|
265
|
+
allowValueFallback: PropTypes.bool,
|
|
266
|
+
limit: PropTypes.number
|
|
259
267
|
};
|
|
260
268
|
export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
261
269
|
selectedOptionDetails: PropTypes.string,
|
|
@@ -269,68 +277,20 @@ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
|
|
|
269
277
|
selectedOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).isRequired,
|
|
270
278
|
selectedOptionsLimit: PropTypes.number,
|
|
271
279
|
getSelectedOptionDetails: PropTypes.func,
|
|
272
|
-
emptyMessage: PropTypes.string.isRequired,
|
|
273
|
-
isDisabled: PropTypes.bool,
|
|
274
|
-
isReadOnly: PropTypes.bool,
|
|
275
|
-
needLocalSearch: PropTypes.bool,
|
|
276
|
-
needSelectAll: PropTypes.bool,
|
|
277
|
-
onChange: PropTypes.func.isRequired,
|
|
278
|
-
searchEmptyMessage: PropTypes.string,
|
|
279
|
-
placeHolder: PropTypes.string,
|
|
280
|
-
selectAllText: PropTypes.string,
|
|
281
|
-
textField: PropTypes.string,
|
|
282
|
-
valueField: PropTypes.string,
|
|
283
280
|
imageField: PropTypes.string,
|
|
284
281
|
iconName: PropTypes.string,
|
|
285
282
|
prefixText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
286
283
|
//For grouping multiSelect
|
|
287
284
|
optionType: PropTypes.oneOf(['default', 'avatar', 'icon']),
|
|
288
|
-
needEffect: PropTypes.bool,
|
|
289
285
|
secondaryField: PropTypes.string,
|
|
290
|
-
animationStyle: PropTypes.string,
|
|
291
|
-
defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
|
|
292
|
-
dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
293
|
-
isAnimate: PropTypes.bool,
|
|
294
|
-
size: PropTypes.oneOf(['medium', 'xmedium']),
|
|
295
|
-
textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
|
|
296
|
-
title: PropTypes.string,
|
|
297
|
-
variant: PropTypes.string,
|
|
298
286
|
dataIdClearIcon: PropTypes.string,
|
|
299
287
|
dataIdLoading: PropTypes.string,
|
|
300
288
|
dataIdMultiSelectComp: PropTypes.string,
|
|
301
289
|
dataIdSelectAllEle: PropTypes.string,
|
|
302
|
-
|
|
303
|
-
/**** Popup Props ****/
|
|
304
|
-
isPopupOpen: PropTypes.bool,
|
|
305
|
-
isPopupReady: PropTypes.bool,
|
|
306
|
-
togglePopup: PropTypes.func,
|
|
307
|
-
getContainerRef: PropTypes.func,
|
|
308
|
-
position: PropTypes.string,
|
|
309
|
-
removeClose: PropTypes.func,
|
|
310
290
|
listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
311
|
-
needBorder: PropTypes.bool,
|
|
312
|
-
htmlId: PropTypes.string,
|
|
313
|
-
i18nKeys: PropTypes.shape({
|
|
314
|
-
clearText: PropTypes.string,
|
|
315
|
-
loadingText: PropTypes.string,
|
|
316
|
-
emptyText: PropTypes.string,
|
|
317
|
-
noMoreText: PropTypes.string,
|
|
318
|
-
searchEmptyText: PropTypes.string
|
|
319
|
-
}),
|
|
320
|
-
a11y: PropTypes.shape({
|
|
321
|
-
clearLabel: PropTypes.string
|
|
322
|
-
}),
|
|
323
|
-
borderColor: PropTypes.oneOf(['transparent', 'default', 'dark']),
|
|
324
|
-
isBoxPaddingNeed: PropTypes.bool,
|
|
325
|
-
isSearchClearOnSelect: PropTypes.bool,
|
|
326
|
-
disabledOptions: PropTypes.arrayOf(PropTypes.string),
|
|
327
|
-
getFooter: PropTypes.func,
|
|
328
291
|
customProps: PropTypes.shape({
|
|
329
292
|
SuggestionsProps: PropTypes.object,
|
|
330
293
|
DropBoxProps: PropTypes.object
|
|
331
294
|
}),
|
|
332
|
-
|
|
333
|
-
dataSelectorId: PropTypes.string,
|
|
334
|
-
customClass: PropTypes.object,
|
|
335
|
-
isFocus: PropTypes.bool
|
|
295
|
+
customClass: PropTypes.object
|
|
336
296
|
};
|
|
@@ -7,6 +7,8 @@ export const getOptions = props => props.options || dummyArray;
|
|
|
7
7
|
|
|
8
8
|
const getOptionsOrder = props => props.optionsOrder || dummyArray;
|
|
9
9
|
|
|
10
|
+
const getLimit = props => props.limit || 0;
|
|
11
|
+
|
|
10
12
|
const getSelectedOptionsSel = props => props.selectedOptions || dummyArray;
|
|
11
13
|
|
|
12
14
|
const getSearchStr = props => props.searchStr || '';
|
|
@@ -206,10 +208,10 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
206
208
|
optionsOrder: remvampOptionIds
|
|
207
209
|
};
|
|
208
210
|
});
|
|
209
|
-
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback) => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelectedOptionsSel, getNormalizedFormatOptions, getSelectedOptionsLength, getAllowValueFallback, getLimit], (selectedOptions, normalizedFormatOptions, selectedOptionsLength, allowValueFallback, limit) => {
|
|
212
|
+
let output = [];
|
|
213
|
+
let revampSelectedOptions = [];
|
|
214
|
+
let normalizedSelectedOptions = {};
|
|
213
215
|
selectedOptionsLength = !getIsEmptyValue(selectedOptionsLength) ? selectedOptionsLength : selectedOptions.length;
|
|
214
216
|
|
|
215
217
|
for (let i = 0; i < selectedOptionsLength; i++) {
|
|
@@ -234,6 +236,12 @@ export const makeGetMultiSelectSelectedOptions = () => createSelector([getSelect
|
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
|
|
239
|
+
if (limit && limit > 0) {
|
|
240
|
+
output = output.slice(0, limit);
|
|
241
|
+
revampSelectedOptions = revampSelectedOptions.slice(0, limit);
|
|
242
|
+
normalizedSelectedOptions = Object.fromEntries(Object.entries(normalizedSelectedOptions).slice(0, limit));
|
|
243
|
+
}
|
|
244
|
+
|
|
237
245
|
return {
|
|
238
246
|
formatSelectedOptions: output,
|
|
239
247
|
normalizedSelectedOptions,
|
|
@@ -423,7 +431,8 @@ export const filterSelectedOptions = function () {
|
|
|
423
431
|
let {
|
|
424
432
|
selectedOptions = dummyArray,
|
|
425
433
|
propSelectedOptions = dummyArray,
|
|
426
|
-
disabledOptions = dummyArray
|
|
434
|
+
disabledOptions = dummyArray,
|
|
435
|
+
limit
|
|
427
436
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
428
437
|
// eslint-disable-next-line no-param-reassign
|
|
429
438
|
selectedOptions = selectedOptions || dummyArray; // eslint-disable-next-line no-param-reassign
|
|
@@ -445,8 +454,18 @@ export const filterSelectedOptions = function () {
|
|
|
445
454
|
|
|
446
455
|
return true;
|
|
447
456
|
});
|
|
457
|
+
const totalSelectedOptions = [...oldValidSelectedOptions, ...newlyAddedOptions];
|
|
458
|
+
|
|
459
|
+
if (limit && limit > 0) {
|
|
460
|
+
if (totalSelectedOptions.length > limit) {
|
|
461
|
+
return {
|
|
462
|
+
newSelectedOptions: totalSelectedOptions.slice(0, limit)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
448
467
|
return {
|
|
449
|
-
newSelectedOptions:
|
|
468
|
+
newSelectedOptions: totalSelectedOptions
|
|
450
469
|
};
|
|
451
470
|
};
|
|
452
471
|
export const makeGetIsShowClearIcon = () => createSelector([getSelectedOptionsSel, getDisabledOptions], (selectedOptions, disabledOptions) => {
|
|
@@ -13,6 +13,8 @@ var _propTypes = require("./props/propTypes");
|
|
|
13
13
|
|
|
14
14
|
var _defaultProps = require("./props/defaultProps");
|
|
15
15
|
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
16
18
|
var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
|
|
17
19
|
|
|
18
20
|
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
@@ -266,7 +268,9 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
266
268
|
}, {
|
|
267
269
|
key: "handleSelectedOptionIdChange",
|
|
268
270
|
value: function handleSelectedOptionIdChange(selectedGroupOptions, normalizedFormatOptions, normalizedSelectedOptions) {
|
|
269
|
-
var
|
|
271
|
+
var _this$props = this.props,
|
|
272
|
+
allowValueFallback = _this$props.allowValueFallback,
|
|
273
|
+
limit = _this$props.limit;
|
|
270
274
|
var newSelectedOptions = selectedGroupOptions.map(function (option) {
|
|
271
275
|
return (0, _dropDownUtils.optionIdGrouping)(option.id, option.groupId);
|
|
272
276
|
});
|
|
@@ -279,16 +283,17 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
279
283
|
selectedOptions: newSelectedOptions,
|
|
280
284
|
normalizedFormatOptions: formatOptions,
|
|
281
285
|
selectedOptionsLength: selectedOptionsLength,
|
|
282
|
-
allowValueFallback: allowValueFallback
|
|
286
|
+
allowValueFallback: allowValueFallback,
|
|
287
|
+
limit: limit
|
|
283
288
|
});
|
|
284
289
|
}
|
|
285
290
|
}, {
|
|
286
291
|
key: "togglePopup",
|
|
287
292
|
value: function togglePopup(e) {
|
|
288
|
-
var _this$
|
|
289
|
-
togglePopup = _this$
|
|
290
|
-
defaultDropBoxPosition = _this$
|
|
291
|
-
isReadOnly = _this$
|
|
293
|
+
var _this$props2 = this.props,
|
|
294
|
+
togglePopup = _this$props2.togglePopup,
|
|
295
|
+
defaultDropBoxPosition = _this$props2.defaultDropBoxPosition,
|
|
296
|
+
isReadOnly = _this$props2.isReadOnly;
|
|
292
297
|
!isReadOnly && togglePopup(e, defaultDropBoxPosition ? "".concat(defaultDropBoxPosition, "Center") : null);
|
|
293
298
|
}
|
|
294
299
|
}, {
|
|
@@ -463,12 +468,13 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
463
468
|
lastHighLightedSelectOption = _this$state5.lastHighLightedSelectOption,
|
|
464
469
|
shiftKeyPressHighLighted = _this$state5.shiftKeyPressHighLighted,
|
|
465
470
|
selectedOptions = _this$state5.selectedOptionIds;
|
|
466
|
-
var _this$
|
|
467
|
-
isNextOptions = _this$
|
|
468
|
-
getNextOptions = _this$
|
|
469
|
-
isPopupOpen = _this$
|
|
470
|
-
isPopupOpenOnEnter = _this$
|
|
471
|
-
onKeyDown = _this$
|
|
471
|
+
var _this$props3 = this.props,
|
|
472
|
+
isNextOptions = _this$props3.isNextOptions,
|
|
473
|
+
getNextOptions = _this$props3.getNextOptions,
|
|
474
|
+
isPopupOpen = _this$props3.isPopupOpen,
|
|
475
|
+
isPopupOpenOnEnter = _this$props3.isPopupOpenOnEnter,
|
|
476
|
+
onKeyDown = _this$props3.onKeyDown,
|
|
477
|
+
limit = _this$props3.limit;
|
|
472
478
|
var highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
473
479
|
|
|
474
480
|
if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27)) {
|
|
@@ -519,7 +525,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
519
525
|
hoverIndex: hoverIndex + 1
|
|
520
526
|
});
|
|
521
527
|
}
|
|
522
|
-
} else if (keyCode === 13) {
|
|
528
|
+
} else if (keyCode === 13 && selectedOptions.length < limit) {
|
|
523
529
|
//enter key
|
|
524
530
|
var id = suggestions[hoverIndex] || {};
|
|
525
531
|
isPopupOpen && !(0, _Common.getIsEmptyValue)(id) && this.handleSelectOption(id, null, null, e);
|
|
@@ -678,9 +684,9 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
678
684
|
value: function handleSearch(value, e) {
|
|
679
685
|
var _this4 = this;
|
|
680
686
|
|
|
681
|
-
var _this$
|
|
682
|
-
onSearch = _this$
|
|
683
|
-
isPopupOpen = _this$
|
|
687
|
+
var _this$props4 = this.props,
|
|
688
|
+
onSearch = _this$props4.onSearch,
|
|
689
|
+
isPopupOpen = _this$props4.isPopupOpen;
|
|
684
690
|
!isPopupOpen && e && this.togglePopup(e);
|
|
685
691
|
var _this$state$searchStr = this.state.searchStr,
|
|
686
692
|
searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
|
|
@@ -747,11 +753,11 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
747
753
|
value: function handleChange() {
|
|
748
754
|
var selectedOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
749
755
|
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
750
|
-
var _this$
|
|
751
|
-
onChange = _this$
|
|
752
|
-
needToCloseOnSelect = _this$
|
|
753
|
-
togglePopup = _this$
|
|
754
|
-
isSearchClearOnSelect = _this$
|
|
756
|
+
var _this$props5 = this.props,
|
|
757
|
+
onChange = _this$props5.onChange,
|
|
758
|
+
needToCloseOnSelect = _this$props5.needToCloseOnSelect,
|
|
759
|
+
togglePopup = _this$props5.togglePopup,
|
|
760
|
+
isSearchClearOnSelect = _this$props5.isSearchClearOnSelect;
|
|
755
761
|
var searchStr = this.state.searchStr;
|
|
756
762
|
var newSelectedOptions = selectedOptions.map(function (option) {
|
|
757
763
|
return (0, _dropDownUtils.extractOptionId)(option);
|
|
@@ -816,9 +822,9 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
816
822
|
}, {
|
|
817
823
|
key: "handleInputFocus",
|
|
818
824
|
value: function handleInputFocus() {
|
|
819
|
-
var _this$
|
|
820
|
-
isDisabled = _this$
|
|
821
|
-
isReadOnly = _this$
|
|
825
|
+
var _this$props6 = this.props,
|
|
826
|
+
isDisabled = _this$props6.isDisabled,
|
|
827
|
+
isReadOnly = _this$props6.isReadOnly;
|
|
822
828
|
this.searchInput && !isDisabled && !isReadOnly && this.searchInput.focus({
|
|
823
829
|
preventScroll: true
|
|
824
830
|
});
|
|
@@ -836,13 +842,13 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
836
842
|
}, {
|
|
837
843
|
key: "componentDidUpdate",
|
|
838
844
|
value: function componentDidUpdate(prevProps) {
|
|
839
|
-
var _this$
|
|
840
|
-
groupedOptions = _this$
|
|
841
|
-
selectedGroupOptions = _this$
|
|
842
|
-
isPopupOpen = _this$
|
|
843
|
-
selectedOptionDetails = _this$
|
|
844
|
-
searchStr = _this$
|
|
845
|
-
notifyPopupToggle = _this$
|
|
845
|
+
var _this$props7 = this.props,
|
|
846
|
+
groupedOptions = _this$props7.groupedOptions,
|
|
847
|
+
selectedGroupOptions = _this$props7.selectedGroupOptions,
|
|
848
|
+
isPopupOpen = _this$props7.isPopupOpen,
|
|
849
|
+
selectedOptionDetails = _this$props7.selectedOptionDetails,
|
|
850
|
+
searchStr = _this$props7.searchStr,
|
|
851
|
+
notifyPopupToggle = _this$props7.notifyPopupToggle;
|
|
846
852
|
var _this$state8 = this.state,
|
|
847
853
|
normalizedFormatOptions = _this$state8.normalizedFormatOptions,
|
|
848
854
|
hoverIndex = _this$state8.hoverIndex;
|
|
@@ -895,10 +901,10 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
895
901
|
var selSuggestion = this["suggestion_".concat(hoverId)];
|
|
896
902
|
isPopupOpen && (0, _Common.scrollTo)(this.suggestionContainer, selSuggestion); //When suggestions length less than 5, getNextOptions function call
|
|
897
903
|
|
|
898
|
-
var _this$
|
|
899
|
-
isNextOptions = _this$
|
|
900
|
-
getNextOptions = _this$
|
|
901
|
-
needLocalSearch = _this$
|
|
904
|
+
var _this$props8 = this.props,
|
|
905
|
+
isNextOptions = _this$props8.isNextOptions,
|
|
906
|
+
getNextOptions = _this$props8.getNextOptions,
|
|
907
|
+
needLocalSearch = _this$props8.needLocalSearch;
|
|
902
908
|
|
|
903
909
|
var _this$handleFilterSug3 = this.handleFilterSuggestions(),
|
|
904
910
|
suggestions = _this$handleFilterSug3.suggestionOptionIds;
|
|
@@ -928,56 +934,59 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
928
934
|
value: function render() {
|
|
929
935
|
var _this5 = this;
|
|
930
936
|
|
|
931
|
-
var _this$
|
|
932
|
-
size = _this$
|
|
933
|
-
textBoxSize = _this$
|
|
934
|
-
selectedGroupOptions = _this$
|
|
935
|
-
placeHolder = _this$
|
|
936
|
-
dataId = _this$
|
|
937
|
-
dataSelectorId = _this$
|
|
938
|
-
isReadOnly = _this$
|
|
939
|
-
isDisabled = _this$
|
|
940
|
-
isPopupOpen = _this$
|
|
941
|
-
isPopupReady = _this$
|
|
942
|
-
defaultDropBoxPosition = _this$
|
|
943
|
-
removeClose = _this$
|
|
944
|
-
needResponsive = _this$
|
|
945
|
-
animationStyle = _this$
|
|
946
|
-
needSelectAll = _this$
|
|
947
|
-
selectAllText = _this$
|
|
948
|
-
dropBoxSize = _this$
|
|
949
|
-
position = _this$
|
|
950
|
-
getContainerRef = _this$
|
|
951
|
-
isAbsolutePositioningNeeded = _this$
|
|
952
|
-
positionsOffset = _this$
|
|
953
|
-
targetOffset = _this$
|
|
954
|
-
isRestrictScroll = _this$
|
|
955
|
-
emptyMessage = _this$
|
|
956
|
-
searchEmptyMessage = _this$
|
|
957
|
-
title = _this$
|
|
958
|
-
variant = _this$
|
|
959
|
-
children = _this$
|
|
960
|
-
listItemSize = _this$
|
|
961
|
-
isDataLoaded = _this$
|
|
962
|
-
needBorder = _this$
|
|
963
|
-
isNextOptions = _this$
|
|
964
|
-
getFooter = _this$
|
|
965
|
-
customClass = _this$
|
|
966
|
-
borderColor = _this$
|
|
967
|
-
isPadding = _this$
|
|
968
|
-
htmlId = _this$
|
|
969
|
-
i18nKeys = _this$
|
|
970
|
-
a11y = _this$
|
|
971
|
-
palette = _this$
|
|
972
|
-
needEffect = _this$
|
|
973
|
-
autoComplete = _this$
|
|
974
|
-
getTargetRef = _this$
|
|
975
|
-
isFocus = _this$
|
|
937
|
+
var _this$props9 = this.props,
|
|
938
|
+
size = _this$props9.size,
|
|
939
|
+
textBoxSize = _this$props9.textBoxSize,
|
|
940
|
+
selectedGroupOptions = _this$props9.selectedGroupOptions,
|
|
941
|
+
placeHolder = _this$props9.placeHolder,
|
|
942
|
+
dataId = _this$props9.dataId,
|
|
943
|
+
dataSelectorId = _this$props9.dataSelectorId,
|
|
944
|
+
isReadOnly = _this$props9.isReadOnly,
|
|
945
|
+
isDisabled = _this$props9.isDisabled,
|
|
946
|
+
isPopupOpen = _this$props9.isPopupOpen,
|
|
947
|
+
isPopupReady = _this$props9.isPopupReady,
|
|
948
|
+
defaultDropBoxPosition = _this$props9.defaultDropBoxPosition,
|
|
949
|
+
removeClose = _this$props9.removeClose,
|
|
950
|
+
needResponsive = _this$props9.needResponsive,
|
|
951
|
+
animationStyle = _this$props9.animationStyle,
|
|
952
|
+
needSelectAll = _this$props9.needSelectAll,
|
|
953
|
+
selectAllText = _this$props9.selectAllText,
|
|
954
|
+
dropBoxSize = _this$props9.dropBoxSize,
|
|
955
|
+
position = _this$props9.position,
|
|
956
|
+
getContainerRef = _this$props9.getContainerRef,
|
|
957
|
+
isAbsolutePositioningNeeded = _this$props9.isAbsolutePositioningNeeded,
|
|
958
|
+
positionsOffset = _this$props9.positionsOffset,
|
|
959
|
+
targetOffset = _this$props9.targetOffset,
|
|
960
|
+
isRestrictScroll = _this$props9.isRestrictScroll,
|
|
961
|
+
emptyMessage = _this$props9.emptyMessage,
|
|
962
|
+
searchEmptyMessage = _this$props9.searchEmptyMessage,
|
|
963
|
+
title = _this$props9.title,
|
|
964
|
+
variant = _this$props9.variant,
|
|
965
|
+
children = _this$props9.children,
|
|
966
|
+
listItemSize = _this$props9.listItemSize,
|
|
967
|
+
isDataLoaded = _this$props9.isDataLoaded,
|
|
968
|
+
needBorder = _this$props9.needBorder,
|
|
969
|
+
isNextOptions = _this$props9.isNextOptions,
|
|
970
|
+
getFooter = _this$props9.getFooter,
|
|
971
|
+
customClass = _this$props9.customClass,
|
|
972
|
+
borderColor = _this$props9.borderColor,
|
|
973
|
+
isPadding = _this$props9.isPadding,
|
|
974
|
+
htmlId = _this$props9.htmlId,
|
|
975
|
+
i18nKeys = _this$props9.i18nKeys,
|
|
976
|
+
a11y = _this$props9.a11y,
|
|
977
|
+
palette = _this$props9.palette,
|
|
978
|
+
needEffect = _this$props9.needEffect,
|
|
979
|
+
autoComplete = _this$props9.autoComplete,
|
|
980
|
+
getTargetRef = _this$props9.getTargetRef,
|
|
981
|
+
isFocus = _this$props9.isFocus,
|
|
982
|
+
limit = _this$props9.limit;
|
|
976
983
|
var _i18nKeys = i18nKeys,
|
|
977
984
|
_i18nKeys$clearText = _i18nKeys.clearText,
|
|
978
|
-
clearText = _i18nKeys$clearText === void 0 ?
|
|
985
|
+
clearText = _i18nKeys$clearText === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _i18nKeys$clearText,
|
|
986
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
987
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
979
988
|
var _a11y$clearLabel = a11y.clearLabel,
|
|
980
|
-
clearLabel = _a11y$clearLabel === void 0 ?
|
|
989
|
+
clearLabel = _a11y$clearLabel === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _a11y$clearLabel;
|
|
981
990
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
982
991
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
983
992
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
|
|
@@ -1110,7 +1119,7 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
1110
1119
|
}, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
1111
1120
|
customClass: "".concat(_MultiSelectModule["default"].box, " ").concat(_MultiSelectModule["default"]["".concat(palette, "Box")]),
|
|
1112
1121
|
onScroll: _this5.handleScroll
|
|
1113
|
-
}, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1122
|
+
}, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1114
1123
|
onSelect: _this5.handleSelectAll,
|
|
1115
1124
|
selectAllText: selectAllText,
|
|
1116
1125
|
suggestions: suggestionOptionIds,
|
|
@@ -1148,6 +1157,8 @@ var AdvancedGroupMultiSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
1148
1157
|
a11y: {
|
|
1149
1158
|
role: 'option'
|
|
1150
1159
|
},
|
|
1160
|
+
limit: limit,
|
|
1161
|
+
limitReachedMessage: limitReachedMessage,
|
|
1151
1162
|
dataId: "".concat(dataId, "_Options")
|
|
1152
1163
|
}));
|
|
1153
1164
|
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
@@ -13,6 +13,8 @@ var _propTypes = require("./props/propTypes");
|
|
|
13
13
|
|
|
14
14
|
var _defaultProps = require("./props/defaultProps");
|
|
15
15
|
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
16
18
|
var _MultiSelect = require("./MultiSelect");
|
|
17
19
|
|
|
18
20
|
var _SelectedOptions = _interopRequireDefault(require("./SelectedOptions"));
|
|
@@ -249,7 +251,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
249
251
|
|
|
250
252
|
var selectedOptionsLimit = props.selectedOptionsLimit,
|
|
251
253
|
selectedOptionDetails = props.selectedOptionDetails,
|
|
252
|
-
allowValueFallback = props.allowValueFallback
|
|
254
|
+
allowValueFallback = props.allowValueFallback,
|
|
255
|
+
limit = props.limit;
|
|
253
256
|
showedSelectedOptionsCount = (0, _Common.getIsEmptyValue)(showedSelectedOptionsCount) ? selectedOptionsLimit : showedSelectedOptionsCount;
|
|
254
257
|
|
|
255
258
|
var _this$handleFormatSel = this.handleFormatSelectedOptions(selectedOptionDetails, props),
|
|
@@ -263,7 +266,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
263
266
|
selectedOptions: selectedOptions,
|
|
264
267
|
normalizedFormatOptions: formatOptions,
|
|
265
268
|
selectedOptionsLength: showedSelectedOptionsCount,
|
|
266
|
-
allowValueFallback: allowValueFallback
|
|
269
|
+
allowValueFallback: allowValueFallback,
|
|
270
|
+
limit: limit
|
|
267
271
|
});
|
|
268
272
|
}
|
|
269
273
|
}, {
|
|
@@ -454,7 +458,8 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
454
458
|
positionsOffset = _this$props6.positionsOffset,
|
|
455
459
|
targetOffset = _this$props6.targetOffset,
|
|
456
460
|
isRestrictScroll = _this$props6.isRestrictScroll,
|
|
457
|
-
isFocus = _this$props6.isFocus
|
|
461
|
+
isFocus = _this$props6.isFocus,
|
|
462
|
+
limit = _this$props6.limit;
|
|
458
463
|
var _customProps$Suggesti = customProps.SuggestionsProps,
|
|
459
464
|
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti,
|
|
460
465
|
_customProps$DropBoxP = customProps.DropBoxProps,
|
|
@@ -463,9 +468,11 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
463
468
|
containerClass = _customClass$containe === void 0 ? '' : _customClass$containe;
|
|
464
469
|
var _i18nKeys = i18nKeys,
|
|
465
470
|
_i18nKeys$clearText = _i18nKeys.clearText,
|
|
466
|
-
clearText = _i18nKeys$clearText === void 0 ?
|
|
471
|
+
clearText = _i18nKeys$clearText === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _i18nKeys$clearText,
|
|
472
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
473
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
467
474
|
var _a11y$clearLabel = a11y.clearLabel,
|
|
468
|
-
clearLabel = _a11y$clearLabel === void 0 ?
|
|
475
|
+
clearLabel = _a11y$clearLabel === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _a11y$clearLabel;
|
|
469
476
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
470
477
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
471
478
|
noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage,
|
|
@@ -604,7 +611,7 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
604
611
|
}, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
605
612
|
customClass: _MultiSelectModule["default"].box,
|
|
606
613
|
onScroll: _this4.handleScroll
|
|
607
|
-
}, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
614
|
+
}, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
608
615
|
onSelect: _this4.handleSelectAll,
|
|
609
616
|
selectAllText: selectAllText,
|
|
610
617
|
suggestions: suggestions,
|
|
@@ -625,7 +632,9 @@ var AdvancedMultiSelectComponent = /*#__PURE__*/function (_MultiSelectComponent)
|
|
|
625
632
|
a11y: {
|
|
626
633
|
role: 'option'
|
|
627
634
|
},
|
|
628
|
-
dataId: "".concat(dataIdMultiSelectComp, "_Options")
|
|
635
|
+
dataId: "".concat(dataIdMultiSelectComp, "_Options"),
|
|
636
|
+
limit: limit,
|
|
637
|
+
limitReachedMessage: limitReachedMessage
|
|
629
638
|
}, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
630
639
|
isLoading: isFetchingOptions,
|
|
631
640
|
options: options,
|
|
@@ -13,6 +13,8 @@ var _propTypes = require("./props/propTypes");
|
|
|
13
13
|
|
|
14
14
|
var _defaultProps = require("./props/defaultProps");
|
|
15
15
|
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
16
18
|
var _MultiSelectModule = _interopRequireDefault(require("./MultiSelect.module.css"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -66,7 +68,7 @@ var EmptyState = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
66
68
|
htmlId = _this$props.htmlId,
|
|
67
69
|
a11y = _this$props.a11y;
|
|
68
70
|
var _i18nKeys$loadingText = i18nKeys.loadingText,
|
|
69
|
-
loadingText = _i18nKeys$loadingText === void 0 ?
|
|
71
|
+
loadingText = _i18nKeys$loadingText === void 0 ? _constants.MULTISELECT_I18N_KEYS.loadingText : _i18nKeys$loadingText,
|
|
70
72
|
_i18nKeys$emptyText = i18nKeys.emptyText,
|
|
71
73
|
emptyText = _i18nKeys$emptyText === void 0 ? emptyMessage : _i18nKeys$emptyText,
|
|
72
74
|
_i18nKeys$noMoreText = i18nKeys.noMoreText,
|