@zohodesk/components 1.4.7 → 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 +17 -4
- package/es/Accordion/Accordion.js +1 -1
- package/es/Card/Card.js +1 -1
- 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 +27 -16
- 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/Popup/Popup.js +45 -17
- package/es/Popup/Registry.js +1 -0
- package/es/Select/Select.js +1 -1
- package/es/Select/__tests__/Select.spec.js +8 -1
- package/es/utils/dropDownUtils.js +25 -6
- package/es/v1/Popup/Popup.js +1 -1
- package/es/v1/Select/Select.js +1 -1
- package/lib/Accordion/Accordion.js +2 -2
- package/lib/Card/Card.js +2 -2
- 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 +30 -17
- 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/Popup/Popup.js +54 -18
- package/lib/Popup/Registry.js +1 -0
- package/lib/Select/Select.js +2 -2
- package/lib/Select/__tests__/Select.spec.js +8 -1
- package/lib/utils/dropDownUtils.js +24 -3
- package/lib/v1/Popup/Popup.js +2 -2
- package/lib/v1/Select/Select.js +2 -2
- package/package.json +11 -9
|
@@ -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,
|
|
@@ -15,6 +15,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
15
15
|
|
|
16
16
|
var _defaultProps2 = require("./MobileHeader/props/defaultProps");
|
|
17
17
|
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
18
20
|
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
19
21
|
|
|
20
22
|
var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
|
|
@@ -172,8 +174,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
172
174
|
// suggestionContainer.addEventListener('scroll', this.handleScroll);
|
|
173
175
|
}
|
|
174
176
|
}, {
|
|
175
|
-
key: "
|
|
176
|
-
value: function
|
|
177
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
178
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
177
179
|
var _this2 = this;
|
|
178
180
|
|
|
179
181
|
var selectedOptions = nextProps.selectedOptions,
|
|
@@ -316,11 +318,13 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
316
318
|
}, {
|
|
317
319
|
key: "handleGetSelectedOptions",
|
|
318
320
|
value: function handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, props) {
|
|
319
|
-
var allowValueFallback = props.allowValueFallback
|
|
321
|
+
var allowValueFallback = props.allowValueFallback,
|
|
322
|
+
limit = props.limit;
|
|
320
323
|
return this.getSelectedOptions({
|
|
321
324
|
selectedOptions: selectedOptions,
|
|
322
325
|
normalizedFormatOptions: normalizedFormatOptions,
|
|
323
|
-
allowValueFallback: allowValueFallback
|
|
326
|
+
allowValueFallback: allowValueFallback,
|
|
327
|
+
limit: limit
|
|
324
328
|
});
|
|
325
329
|
}
|
|
326
330
|
}, {
|
|
@@ -393,7 +397,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
393
397
|
getNextOptions = _this$props5.getNextOptions,
|
|
394
398
|
isPopupOpen = _this$props5.isPopupOpen,
|
|
395
399
|
isPopupOpenOnEnter = _this$props5.isPopupOpenOnEnter,
|
|
396
|
-
onKeyDown = _this$props5.onKeyDown
|
|
400
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
401
|
+
limit = _this$props5.limit;
|
|
402
|
+
var allowKeyboardActions = !limit || limit && selectedOptions.length < limit;
|
|
397
403
|
var highLightedSelectOptionsLen = highLightedSelectOptions.length;
|
|
398
404
|
|
|
399
405
|
if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
|
|
@@ -413,7 +419,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
413
419
|
|
|
414
420
|
var suggestionsLen = suggestions.length;
|
|
415
421
|
|
|
416
|
-
if (suggestionsLen && isPopupOpen && keyCode === 38) {
|
|
422
|
+
if (suggestionsLen && isPopupOpen && keyCode === 38 && allowKeyboardActions) {
|
|
417
423
|
//up arrow
|
|
418
424
|
|
|
419
425
|
/*if (hoverOption === 0) { //disable first to last option higlight
|
|
@@ -424,7 +430,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
424
430
|
hoverOption: hoverOption - 1
|
|
425
431
|
});
|
|
426
432
|
}
|
|
427
|
-
} else if (suggestionsLen && isPopupOpen && keyCode === 40) {
|
|
433
|
+
} else if (suggestionsLen && isPopupOpen && keyCode === 40 && allowKeyboardActions) {
|
|
428
434
|
//down arrow
|
|
429
435
|
|
|
430
436
|
/*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
|
|
@@ -441,8 +447,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
441
447
|
hoverOption: hoverOption + 1
|
|
442
448
|
});
|
|
443
449
|
}
|
|
444
|
-
} else if (keyCode === 13) {
|
|
445
|
-
//enter
|
|
450
|
+
} else if (keyCode === 13 && allowKeyboardActions) {
|
|
451
|
+
//enter ke
|
|
446
452
|
var selectedOption = suggestions[hoverOption] || {};
|
|
447
453
|
var id = selectedOption.id;
|
|
448
454
|
isPopupOpen && !(0, _Common.getIsEmptyValue)(id) && this.handleSelectOption(id, e);
|
|
@@ -809,12 +815,14 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
809
815
|
togglePopup = _this$props10.togglePopup,
|
|
810
816
|
propSelectedOptions = _this$props10.selectedOptions,
|
|
811
817
|
_this$props10$disable = _this$props10.disabledOptions,
|
|
812
|
-
disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable
|
|
818
|
+
disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable,
|
|
819
|
+
limit = _this$props10.limit;
|
|
813
820
|
|
|
814
821
|
var _filterSelectedOption = (0, _dropDownUtils.filterSelectedOptions)({
|
|
815
822
|
selectedOptions: selectedOptions,
|
|
816
823
|
propSelectedOptions: propSelectedOptions,
|
|
817
|
-
disabledOptions: disabledOptions
|
|
824
|
+
disabledOptions: disabledOptions,
|
|
825
|
+
limit: limit
|
|
818
826
|
}),
|
|
819
827
|
newSelectedOptions = _filterSelectedOption.newSelectedOptions;
|
|
820
828
|
|
|
@@ -973,9 +981,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
973
981
|
highLightedSelectOptions = _this$state8.highLightedSelectOptions,
|
|
974
982
|
searchStr = _this$state8.searchStr;
|
|
975
983
|
var _i18nKeys$clearText = i18nKeys.clearText,
|
|
976
|
-
clearText = _i18nKeys$clearText === void 0 ?
|
|
984
|
+
clearText = _i18nKeys$clearText === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearText : _i18nKeys$clearText;
|
|
977
985
|
var _a11y$clearLabel = a11y.clearLabel,
|
|
978
|
-
clearLabel = _a11y$clearLabel === void 0 ?
|
|
986
|
+
clearLabel = _a11y$clearLabel === void 0 ? _constants.MULTISELECT_I18N_KEYS.clearLabel : _a11y$clearLabel,
|
|
979
987
|
ariaLabelledby = a11y.ariaLabelledby;
|
|
980
988
|
|
|
981
989
|
var _this$getIsShowClearI = this.getIsShowClearIcon({
|
|
@@ -1110,7 +1118,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1110
1118
|
boxSize = _this$props15.boxSize,
|
|
1111
1119
|
isLoading = _this$props15.isLoading,
|
|
1112
1120
|
selectAllText = _this$props15.selectAllText,
|
|
1113
|
-
needSelectAll = _this$props15.needSelectAll
|
|
1121
|
+
needSelectAll = _this$props15.needSelectAll,
|
|
1122
|
+
limit = _this$props15.limit;
|
|
1114
1123
|
var _this$state9 = this.state,
|
|
1115
1124
|
selectedOptions = _this$state9.selectedOptions,
|
|
1116
1125
|
searchStr = _this$state9.searchStr,
|
|
@@ -1120,7 +1129,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1120
1129
|
selectedOptionIds = _this$state9.selectedOptionIds;
|
|
1121
1130
|
var _i18nKeys = i18nKeys,
|
|
1122
1131
|
_i18nKeys$searchText = _i18nKeys.searchText,
|
|
1123
|
-
searchText = _i18nKeys$searchText === void 0 ?
|
|
1132
|
+
searchText = _i18nKeys$searchText === void 0 ? _constants.MULTISELECT_I18N_KEYS.searchText : _i18nKeys$searchText,
|
|
1133
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
1134
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
1124
1135
|
var suggestions = this.handleFilterSuggestions();
|
|
1125
1136
|
var setAriaId = this.getNextAriaId();
|
|
1126
1137
|
var ariaErrorId = this.getNextAriaId();
|
|
@@ -1173,7 +1184,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1173
1184
|
onClick: this.handlePopupClose
|
|
1174
1185
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1175
1186
|
className: _MultiSelectModule["default"].effect
|
|
1176
|
-
}, this.getSelectionUI(true))) : null, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1187
|
+
}, this.getSelectionUI(true))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
1177
1188
|
onSelect: this.handleSelectAll,
|
|
1178
1189
|
selectAllText: selectAllText,
|
|
1179
1190
|
suggestions: suggestions,
|
|
@@ -1199,7 +1210,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1199
1210
|
selectedOptions: selectedOptionIds,
|
|
1200
1211
|
a11y: {
|
|
1201
1212
|
role: 'option'
|
|
1202
|
-
}
|
|
1213
|
+
},
|
|
1214
|
+
limit: limit,
|
|
1215
|
+
limitReachedMessage: limitReachedMessage
|
|
1203
1216
|
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
1204
1217
|
isLoading: isFetchingOptions,
|
|
1205
1218
|
options: options,
|
|
@@ -15,6 +15,8 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
15
15
|
|
|
16
16
|
var _defaultProps2 = require("./MobileHeader/props/defaultProps");
|
|
17
17
|
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
|
|
18
20
|
var _MultiSelect = require("./MultiSelect");
|
|
19
21
|
|
|
20
22
|
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
@@ -151,9 +153,13 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
151
153
|
needEffect = _this$props.needEffect,
|
|
152
154
|
isLoading = _this$props.isLoading,
|
|
153
155
|
keepSelectedOptions = _this$props.keepSelectedOptions,
|
|
154
|
-
customProps = _this$props.customProps
|
|
156
|
+
customProps = _this$props.customProps,
|
|
157
|
+
limit = _this$props.limit;
|
|
155
158
|
var _customProps$Suggesti = customProps.SuggestionsProps,
|
|
156
159
|
SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
|
|
160
|
+
var _i18nKeys = i18nKeys,
|
|
161
|
+
_i18nKeys$limitReache = _i18nKeys.limitReachedMessage,
|
|
162
|
+
limitReachedMessage = _i18nKeys$limitReache === void 0 ? _constants.MULTISELECT_I18N_KEYS.limitReachedMessage : _i18nKeys$limitReache;
|
|
157
163
|
i18nKeys = Object.assign({}, _defaultProps2.defaultProps.i18nKeys, i18nKeys, {
|
|
158
164
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
159
165
|
searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
|
|
@@ -213,7 +219,7 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
213
219
|
onClick: this.handlePopupClose
|
|
214
220
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
215
221
|
className: _MultiSelectModule["default"].effect
|
|
216
|
-
}, this.getSelectionUI(true)))) : null, needSelectAll ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
222
|
+
}, this.getSelectionUI(true)))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement(_MultiSelectHeader["default"], {
|
|
217
223
|
onSelect: this.handleSelectAll,
|
|
218
224
|
selectAllText: selectAllText,
|
|
219
225
|
suggestions: suggestions,
|
|
@@ -238,7 +244,9 @@ var MultiSelectWithAvatarComponent = /*#__PURE__*/function (_MultiSelectComponen
|
|
|
238
244
|
selectedOptions: selectedOptionIds,
|
|
239
245
|
a11y: {
|
|
240
246
|
role: 'option'
|
|
241
|
-
}
|
|
247
|
+
},
|
|
248
|
+
limit: limit,
|
|
249
|
+
limitReachedMessage: limitReachedMessage
|
|
242
250
|
}, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
243
251
|
isLoading: isFetchingOptions,
|
|
244
252
|
options: options,
|
|
@@ -67,9 +67,11 @@ var SelectedOptions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
67
67
|
onSelect = _this$props.onSelect,
|
|
68
68
|
size = _this$props.size,
|
|
69
69
|
palette = _this$props.palette,
|
|
70
|
-
dataId = _this$props.dataId
|
|
70
|
+
dataId = _this$props.dataId,
|
|
71
|
+
limit = _this$props.limit;
|
|
71
72
|
var isDarkPalette = palette === 'dark' ? 'dark' : 'danger';
|
|
72
|
-
|
|
73
|
+
var selectedData = limit && limit > 0 ? selectedOptions.slice(0, limit) : selectedOptions;
|
|
74
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedData.map(function (option) {
|
|
73
75
|
var id = option.id,
|
|
74
76
|
value = option.value,
|
|
75
77
|
photoURL = option.photoURL,
|
|
@@ -84,9 +84,12 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
84
84
|
palette = _this$props.palette,
|
|
85
85
|
htmlId = _this$props.htmlId,
|
|
86
86
|
a11y = _this$props.a11y,
|
|
87
|
-
needMultiLineText = _this$props.needMultiLineText
|
|
87
|
+
needMultiLineText = _this$props.needMultiLineText,
|
|
88
|
+
limit = _this$props.limit,
|
|
89
|
+
limitReachedMessage = _this$props.limitReachedMessage;
|
|
88
90
|
var ariaParentRole = a11y.ariaParentRole,
|
|
89
91
|
ariaMultiselectable = a11y.ariaMultiselectable;
|
|
92
|
+
var selectedOptionsLength = selectedOptions.length;
|
|
90
93
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
91
94
|
isCover: false,
|
|
92
95
|
role: ariaParentRole,
|
|
@@ -110,6 +113,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
110
113
|
listItemCustomProps = _suggestion$listItemC === void 0 ? {} : _suggestion$listItemC;
|
|
111
114
|
var isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
|
|
112
115
|
var isHighlight = hoverOption === index || id === hoverId ? true : false;
|
|
116
|
+
var isLimitReached = selectedOptionsLength >= limit && !isActive;
|
|
113
117
|
var list_a11y = Object.assign({}, a11y, {
|
|
114
118
|
ariaSelected: isActive,
|
|
115
119
|
ariaLabel: value,
|
|
@@ -117,7 +121,7 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
121
|
});
|
|
118
122
|
|
|
119
123
|
var commonProps = _objectSpread({
|
|
120
|
-
isDisabled: isDisabled,
|
|
124
|
+
isDisabled: isDisabled ? isDisabled : isLimitReached,
|
|
121
125
|
needMultiLineText: needMultiLineText
|
|
122
126
|
}, listItemCustomProps);
|
|
123
127
|
|
|
@@ -127,6 +131,10 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
127
131
|
};
|
|
128
132
|
}
|
|
129
133
|
|
|
134
|
+
if (isLimitReached) {
|
|
135
|
+
commonProps.disableTitle = limitReachedMessage;
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
if (optionType === 'avatar') {
|
|
131
139
|
return /*#__PURE__*/_react["default"].createElement(_ListItemWithAvatar["default"], _extends({}, commonProps, {
|
|
132
140
|
autoHover: false,
|
|
@@ -8,6 +8,8 @@ var _MultiSelect = _interopRequireDefault(require("../MultiSelect"));
|
|
|
8
8
|
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
10
|
|
|
11
|
+
var testData = ['text1', 'text2', 'text3', 'text4', 'text5', 'text6', 'text7', 'text8', 'text9', 'text10'];
|
|
12
|
+
var testSelectedData = ['text1', 'text2', 'text3'];
|
|
11
13
|
describe('MultiSelect', function () {
|
|
12
14
|
test('rendering the defult props', function () {
|
|
13
15
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_MultiSelect["default"], null)),
|
|
@@ -15,4 +17,27 @@ describe('MultiSelect', function () {
|
|
|
15
17
|
|
|
16
18
|
expect(asFragment()).toMatchSnapshot();
|
|
17
19
|
});
|
|
20
|
+
test('rendering with limit feature', function () {
|
|
21
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_MultiSelect["default"], {
|
|
22
|
+
valueField: "id",
|
|
23
|
+
textField: "text",
|
|
24
|
+
options: testData,
|
|
25
|
+
selectedOptions: testSelectedData,
|
|
26
|
+
needSelectAll: true,
|
|
27
|
+
selectAllText: "Select All",
|
|
28
|
+
placeHolder: "Select Text",
|
|
29
|
+
i18nKeys: {
|
|
30
|
+
clearText: 'Clear Selected Items',
|
|
31
|
+
loadingText: 'Fetching...',
|
|
32
|
+
emptyText: 'No Options .',
|
|
33
|
+
noMoreText: 'No More Options .',
|
|
34
|
+
searchEmptyText: 'No Matches Found .'
|
|
35
|
+
},
|
|
36
|
+
needResponsive: true,
|
|
37
|
+
limit: 3
|
|
38
|
+
})),
|
|
39
|
+
asFragment = _render2.asFragment;
|
|
40
|
+
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
18
43
|
});
|