@zohodesk/components 1.0.0-temp-233 → 1.0.0-temp-234
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 +35 -0
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
- package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +461 -8
- package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +461 -8
- package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +461 -8
- package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +461 -8
- package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +461 -8
- package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
- package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +461 -8
- package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +461 -8
- package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +461 -8
- package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +461 -8
- package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +461 -8
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
- package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +461 -8
- package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +461 -8
- package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +461 -8
- package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +461 -8
- package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +461 -8
- package/es/ListItem/ListItem.js +7 -3
- package/es/ListItem/ListItemWithAvatar.js +12 -6
- package/es/ListItem/ListItemWithCheckBox.js +12 -6
- package/es/ListItem/ListItemWithIcon.js +11 -5
- package/es/ListItem/ListItemWithRadio.js +12 -6
- package/es/ListItem/__tests__/ListItem.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +19 -0
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +17 -0
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +19 -0
- package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
- package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
- package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
- package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
- package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
- package/es/ListItem/props/propTypes.js +15 -5
- package/es/MultiSelect/MultiSelect.js +44 -13
- package/es/MultiSelect/Suggestions.js +171 -100
- package/es/MultiSelect/props/defaultProps.js +2 -0
- package/es/MultiSelect/props/propTypes.js +4 -0
- package/es/Select/GroupSelect.js +4 -2
- package/es/Select/Select.js +47 -12
- package/es/Select/SelectWithAvatar.js +14 -3
- package/es/Select/SelectWithIcon.js +6 -2
- package/es/Select/props/defaultProps.js +2 -0
- package/es/Select/props/propTypes.js +6 -0
- package/es/utils/Common.js +2 -1
- package/es/utils/dropDownUtils.js +15 -4
- package/lib/ListItem/ListItem.js +8 -3
- package/lib/ListItem/ListItemWithAvatar.js +13 -6
- package/lib/ListItem/ListItemWithCheckBox.js +13 -6
- package/lib/ListItem/ListItemWithIcon.js +11 -5
- package/lib/ListItem/ListItemWithRadio.js +13 -6
- package/lib/ListItem/__tests__/ListItem.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +23 -0
- package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +21 -0
- package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +23 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
- package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
- package/lib/ListItem/props/propTypes.js +15 -6
- package/lib/MultiSelect/MultiSelect.js +42 -12
- package/lib/MultiSelect/Suggestions.js +174 -104
- package/lib/MultiSelect/props/defaultProps.js +2 -0
- package/lib/MultiSelect/props/propTypes.js +4 -0
- package/lib/Select/GroupSelect.js +4 -3
- package/lib/Select/Select.js +46 -9
- package/lib/Select/SelectWithAvatar.js +14 -6
- package/lib/Select/SelectWithIcon.js +6 -3
- package/lib/Select/props/defaultProps.js +2 -0
- package/lib/Select/props/propTypes.js +6 -0
- package/lib/utils/Common.js +4 -2
- package/lib/utils/dropDownUtils.js +17 -4
- package/package.json +6 -6
package/lib/Select/Select.js
CHANGED
|
@@ -168,6 +168,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
168
168
|
_this.handleAddNewOption = _this.handleAddNewOption.bind(_assertThisInitialized(_this));
|
|
169
169
|
_this.handleExposePopupHandlers = _this.handleExposePopupHandlers.bind(_assertThisInitialized(_this));
|
|
170
170
|
_this.handleGetAddNewOptionText = _this.handleGetAddNewOptionText.bind(_assertThisInitialized(_this));
|
|
171
|
+
_this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
|
|
172
|
+
_this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
|
|
171
173
|
_this.valueInputTypeString = '';
|
|
172
174
|
_this.valueInputSearchString = '';
|
|
173
175
|
_this.autoSelectSuggestions = [];
|
|
@@ -234,11 +236,9 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
234
236
|
}
|
|
235
237
|
}, {
|
|
236
238
|
key: "componentDidUpdate",
|
|
237
|
-
value: function componentDidUpdate(prevProps) {
|
|
239
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
238
240
|
var _this2 = this;
|
|
239
241
|
|
|
240
|
-
var suggestionContainer = this.suggestionContainer,
|
|
241
|
-
optionsOrder = this.optionsOrder;
|
|
242
242
|
var _this$state = this.state,
|
|
243
243
|
hoverIndex = _this$state.hoverIndex,
|
|
244
244
|
searchStr = _this$state.searchStr,
|
|
@@ -250,14 +250,28 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
250
250
|
needSearch = _this$props.needSearch,
|
|
251
251
|
onSearch = _this$props.onSearch,
|
|
252
252
|
isPopupOpen = _this$props.isPopupOpen,
|
|
253
|
-
isSearchClearOnClose = _this$props.isSearchClearOnClose
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
isSearchClearOnClose = _this$props.isSearchClearOnClose,
|
|
254
|
+
isVirtualizerEnabled = _this$props.isVirtualizerEnabled;
|
|
255
|
+
|
|
256
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
257
|
+
var position = prevState.hoverIndex > hoverIndex ? 'top' : 'bottom';
|
|
258
|
+
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex, position);
|
|
259
|
+
} else {
|
|
260
|
+
var suggestionContainer = this.suggestionContainer,
|
|
261
|
+
optionsOrder = this.optionsOrder;
|
|
262
|
+
var hoverId = (0, _Common.getIsEmptyValue)(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
|
|
263
|
+
var selSuggestion = this["suggestion_".concat(hoverId)];
|
|
264
|
+
isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
|
|
265
|
+
}
|
|
257
266
|
|
|
258
267
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
259
268
|
if (isPopupOpen) {
|
|
260
269
|
onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
270
|
+
|
|
271
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
272
|
+
this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex);
|
|
273
|
+
}
|
|
274
|
+
|
|
261
275
|
setTimeout(function () {
|
|
262
276
|
_this2.searchInput && _this2.searchInput.focus({
|
|
263
277
|
preventScroll: true
|
|
@@ -309,13 +323,17 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
309
323
|
textField = props.textField,
|
|
310
324
|
allowValueFallback = props.allowValueFallback,
|
|
311
325
|
_props$customProps = props.customProps,
|
|
312
|
-
customProps = _props$customProps === void 0 ?
|
|
326
|
+
customProps = _props$customProps === void 0 ? _dropDownUtils.dummyObj : _props$customProps,
|
|
327
|
+
searchFields = props.searchFields,
|
|
328
|
+
secondaryField = props.secondaryField;
|
|
313
329
|
var _customProps$listItem = customProps.listItemProps,
|
|
314
|
-
listItemProps = _customProps$listItem === void 0 ?
|
|
330
|
+
listItemProps = _customProps$listItem === void 0 ? _dropDownUtils.dummyObj : _customProps$listItem;
|
|
315
331
|
return this.formatOptions({
|
|
316
332
|
options: options,
|
|
317
333
|
valueField: valueField,
|
|
318
334
|
textField: textField,
|
|
335
|
+
secondaryField: secondaryField,
|
|
336
|
+
searchFields: searchFields,
|
|
319
337
|
listItemProps: listItemProps,
|
|
320
338
|
allowValueFallback: allowValueFallback
|
|
321
339
|
});
|
|
@@ -474,6 +492,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
474
492
|
value: function handleFilterSuggestions() {
|
|
475
493
|
var _this$props5 = this.props,
|
|
476
494
|
needLocalSearch = _this$props5.needLocalSearch,
|
|
495
|
+
searchFields = _this$props5.searchFields,
|
|
477
496
|
_this$props5$excludeO = _this$props5.excludeOptions,
|
|
478
497
|
excludeOptions = _this$props5$excludeO === void 0 ? dummyArray : _this$props5$excludeO;
|
|
479
498
|
var _this$state3 = this.state,
|
|
@@ -491,6 +510,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
491
510
|
options: options,
|
|
492
511
|
selectedOptions: excludeOptions,
|
|
493
512
|
searchStr: searchStr,
|
|
513
|
+
searchFields: searchFields,
|
|
494
514
|
needSearch: needLocalSearch
|
|
495
515
|
}),
|
|
496
516
|
suggestions = _this$getFilterSugges.suggestions,
|
|
@@ -574,6 +594,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
574
594
|
key: "suggestionContainerRef",
|
|
575
595
|
value: function suggestionContainerRef(el) {
|
|
576
596
|
this.suggestionContainer = el;
|
|
597
|
+
typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
|
|
577
598
|
}
|
|
578
599
|
}, {
|
|
579
600
|
key: "suggestionItemRef",
|
|
@@ -721,6 +742,17 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
721
742
|
onAddNewOption: this.handleAddNewOption
|
|
722
743
|
});
|
|
723
744
|
}
|
|
745
|
+
}, {
|
|
746
|
+
key: "getVirtualizerPublicMethods",
|
|
747
|
+
value: function getVirtualizerPublicMethods(methods) {
|
|
748
|
+
this.virtualizerMethods = methods;
|
|
749
|
+
}
|
|
750
|
+
}, {
|
|
751
|
+
key: "setSuggestionsVirtualizerContainerRefFunction",
|
|
752
|
+
value: function setSuggestionsVirtualizerContainerRefFunction(refFunc) {
|
|
753
|
+
this.setSuggestionsVirtualizerRef = refFunc;
|
|
754
|
+
this.suggestionContainer && refFunc(this.suggestionContainer);
|
|
755
|
+
}
|
|
724
756
|
}, {
|
|
725
757
|
key: "render",
|
|
726
758
|
value: function render() {
|
|
@@ -777,6 +809,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
777
809
|
targetOffset = _this$props11.targetOffset,
|
|
778
810
|
isRestrictScroll = _this$props11.isRestrictScroll,
|
|
779
811
|
dropBoxPortalId = _this$props11.dropBoxPortalId,
|
|
812
|
+
isVirtualizerEnabled = _this$props11.isVirtualizerEnabled,
|
|
780
813
|
renderCustomToggleIndicator = _this$props11.renderCustomToggleIndicator,
|
|
781
814
|
renderCustomSearchClearComponent = _this$props11.renderCustomSearchClearComponent;
|
|
782
815
|
var _i18nKeys = i18nKeys,
|
|
@@ -975,7 +1008,11 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
975
1008
|
customClass: !tabletMode && dropBoxSize ? _SelectModule["default"][dropBoxSize] : '',
|
|
976
1009
|
eleRef: _this7.suggestionContainerRef
|
|
977
1010
|
}, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
|
|
1011
|
+
key: searchStr.trim(),
|
|
978
1012
|
activeId: selectedId,
|
|
1013
|
+
isVirtualizerEnabled: isVirtualizerEnabled,
|
|
1014
|
+
getVirtualizerPublicMethods: _this7.getVirtualizerPublicMethods,
|
|
1015
|
+
setVirtualizerContainerRefFunction: _this7.setSuggestionsVirtualizerContainerRefFunction,
|
|
979
1016
|
suggestions: suggestions,
|
|
980
1017
|
getRef: _this7.suggestionItemRef,
|
|
981
1018
|
hoverOption: hoverIndex,
|
|
@@ -51,6 +51,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
51
51
|
|
|
52
52
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
53
53
|
|
|
54
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
55
|
+
|
|
54
56
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
57
|
|
|
56
58
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -99,12 +101,14 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
99
101
|
valueField = props.valueField,
|
|
100
102
|
textField = props.textField,
|
|
101
103
|
imageField = props.imageField,
|
|
104
|
+
secondaryField = props.secondaryField,
|
|
102
105
|
allowValueFallback = props.allowValueFallback;
|
|
103
106
|
return this.formatOptions({
|
|
104
107
|
options: options,
|
|
105
108
|
valueField: valueField,
|
|
106
109
|
textField: textField,
|
|
107
110
|
imageField: imageField,
|
|
111
|
+
secondaryField: secondaryField,
|
|
108
112
|
optionType: 'avatar',
|
|
109
113
|
allowValueFallback: allowValueFallback
|
|
110
114
|
});
|
|
@@ -215,6 +219,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
215
219
|
needEffect = _this$props.needEffect,
|
|
216
220
|
isLoading = _this$props.isLoading,
|
|
217
221
|
dataSelectorId = _this$props.dataSelectorId,
|
|
222
|
+
customProps = _this$props.customProps,
|
|
218
223
|
getTargetRef = _this$props.getTargetRef;
|
|
219
224
|
i18nKeys = Object.assign({}, i18nKeys, {
|
|
220
225
|
emptyText: i18nKeys.emptyText || emptyMessage,
|
|
@@ -236,6 +241,9 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
236
241
|
|
|
237
242
|
var setAriaId = this.getNextAriaId();
|
|
238
243
|
var ariaErrorId = this.getNextAriaId();
|
|
244
|
+
var TextBoxProps = customProps.TextBoxProps,
|
|
245
|
+
DropdownSearchTextBoxProps = customProps.DropdownSearchTextBoxProps,
|
|
246
|
+
SuggestionsProps = customProps.SuggestionsProps;
|
|
239
247
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
240
248
|
className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : '', " ").concat(className ? className : ''),
|
|
241
249
|
"data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
|
|
@@ -267,7 +275,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
267
275
|
flexible: true,
|
|
268
276
|
className: _MultiSelectModule["default"].textBox,
|
|
269
277
|
dataId: "".concat(dataId, "_textBox")
|
|
270
|
-
}, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
|
|
278
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], _extends({
|
|
271
279
|
a11y: {
|
|
272
280
|
ariaActivedescendant: selectedId,
|
|
273
281
|
role: 'combobox',
|
|
@@ -296,7 +304,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
296
304
|
borderColor: borderColor,
|
|
297
305
|
htmlId: htmlId,
|
|
298
306
|
autoComplete: false
|
|
299
|
-
}))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
307
|
+
}, TextBoxProps)))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
300
308
|
query: this.responsiveFunc,
|
|
301
309
|
responsiveId: "Helmet"
|
|
302
310
|
}, function (_ref4) {
|
|
@@ -327,7 +335,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
327
335
|
onScroll: _this2.handleScroll
|
|
328
336
|
}, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
329
337
|
className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
|
|
330
|
-
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
|
|
338
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
|
|
331
339
|
inputRef: _this2.searchInputRef,
|
|
332
340
|
maxLength: maxLength,
|
|
333
341
|
onChange: _this2.handleSearch,
|
|
@@ -343,7 +351,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
343
351
|
ariaDescribedby: ariaErrorId
|
|
344
352
|
},
|
|
345
353
|
autoComplete: false
|
|
346
|
-
}))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
354
|
+
}, DropdownSearchTextBoxProps)))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
|
|
347
355
|
shrink: true,
|
|
348
356
|
customClass: !tabletMode && dropBoxSize ? _MultiSelectModule["default"][dropBoxSize] : '',
|
|
349
357
|
eleRef: _this2.suggestionContainerRef
|
|
@@ -354,7 +362,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
354
362
|
a11y: {
|
|
355
363
|
role: 'heading'
|
|
356
364
|
}
|
|
357
|
-
})) : null, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
365
|
+
})) : null, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
|
|
358
366
|
dataId: "".concat(dataId, "_Options"),
|
|
359
367
|
activeId: selectedId,
|
|
360
368
|
suggestions: suggestions,
|
|
@@ -371,7 +379,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
|
|
|
371
379
|
ariaParentRole: 'listbox',
|
|
372
380
|
role: 'option'
|
|
373
381
|
}
|
|
374
|
-
}) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
382
|
+
}, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
375
383
|
isLoading: isFetchingOptions,
|
|
376
384
|
options: options,
|
|
377
385
|
searchString: searchStr,
|
|
@@ -401,6 +401,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
|
|
|
401
401
|
targetOffset = _this$props7.targetOffset,
|
|
402
402
|
isRestrictScroll = _this$props7.isRestrictScroll,
|
|
403
403
|
valueKey = _this$props7.valueKey,
|
|
404
|
+
secondaryValueKey = _this$props7.secondaryValueKey,
|
|
404
405
|
idKey = _this$props7.idKey,
|
|
405
406
|
needListBorder = _this$props7.needListBorder,
|
|
406
407
|
needTick = _this$props7.needTick,
|
|
@@ -440,7 +441,8 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
|
|
|
440
441
|
_customProps$Dropdown = customProps.DropdownSearchTextBoxProps,
|
|
441
442
|
DropdownSearchTextBoxProps = _customProps$Dropdown === void 0 ? {} : _customProps$Dropdown,
|
|
442
443
|
_customProps$TextBoxI = customProps.TextBoxIconProps,
|
|
443
|
-
TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI
|
|
444
|
+
TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
|
|
445
|
+
ListItemProps = customProps.ListItemProps;
|
|
444
446
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
445
447
|
className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : ''),
|
|
446
448
|
"data-title": isDisabled ? title : null,
|
|
@@ -573,9 +575,10 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
|
|
|
573
575
|
var iconName = options.iconName,
|
|
574
576
|
iconSize = options.iconSize,
|
|
575
577
|
iconColor = options.iconColor;
|
|
576
|
-
return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], {
|
|
578
|
+
return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({
|
|
577
579
|
key: options[idKey],
|
|
578
580
|
value: options[valueKey],
|
|
581
|
+
secondaryValue: options[secondaryValueKey],
|
|
579
582
|
size: "medium",
|
|
580
583
|
onClick: _this5.handleChange,
|
|
581
584
|
id: options[idKey],
|
|
@@ -597,7 +600,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
|
|
|
597
600
|
ariaSelected: selectedId === options[idKey],
|
|
598
601
|
ariaLabel: options[valueKey]
|
|
599
602
|
}
|
|
600
|
-
});
|
|
603
|
+
}, ListItemProps));
|
|
601
604
|
})) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
|
|
602
605
|
isLoading: isFetchingOptions,
|
|
603
606
|
options: options,
|
|
@@ -18,6 +18,7 @@ var Select_defaultProps = {
|
|
|
18
18
|
dataId: 'selectComponent',
|
|
19
19
|
dataSelectorId: 'select',
|
|
20
20
|
dropBoxSize: 'small',
|
|
21
|
+
isVirtualizerEnabled: false,
|
|
21
22
|
isDefaultSelectValue: true,
|
|
22
23
|
isDisabled: false,
|
|
23
24
|
isPopupOpenOnEnter: false,
|
|
@@ -111,6 +112,7 @@ var SelectWithAvatar_defaultProps = {
|
|
|
111
112
|
isAbsolutePositioningNeeded: true,
|
|
112
113
|
isRestrictScroll: false,
|
|
113
114
|
i18nKeys: {},
|
|
115
|
+
customProps: {},
|
|
114
116
|
needEffect: true,
|
|
115
117
|
isLoading: false
|
|
116
118
|
};
|
|
@@ -28,6 +28,7 @@ var Select_propTypes = {
|
|
|
28
28
|
defaultDropBoxPosition: _propTypes["default"].string,
|
|
29
29
|
dropBoxSize: _propTypes["default"].oneOf(['small', 'medium', 'large']),
|
|
30
30
|
emptyMessage: _propTypes["default"].string,
|
|
31
|
+
isVirtualizerEnabled: _propTypes["default"].bool,
|
|
31
32
|
excludeOptions: _propTypes["default"].array,
|
|
32
33
|
getChildren: _propTypes["default"].func,
|
|
33
34
|
getContainerRef: _propTypes["default"].func,
|
|
@@ -79,6 +80,8 @@ var Select_propTypes = {
|
|
|
79
80
|
searchBoxSize: _propTypes["default"].string,
|
|
80
81
|
searchDebounceTime: _propTypes["default"].number,
|
|
81
82
|
searchEmptyMessage: _propTypes["default"].string,
|
|
83
|
+
searchFields: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
84
|
+
secondaryField: _propTypes["default"].string,
|
|
82
85
|
selectedValue: _propTypes["default"].oneOfType([_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]), _propTypes["default"].shape({
|
|
83
86
|
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
84
87
|
text: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
|
@@ -137,6 +140,7 @@ var GroupSelect_propTypes = {
|
|
|
137
140
|
searchBoxPlaceHolder: _propTypes["default"].string,
|
|
138
141
|
needSearch: _propTypes["default"].bool,
|
|
139
142
|
searchEmptyMessage: _propTypes["default"].string,
|
|
143
|
+
secondaryField: _propTypes["default"].string,
|
|
140
144
|
getRef: _propTypes["default"].func,
|
|
141
145
|
isDisabled: _propTypes["default"].bool,
|
|
142
146
|
isReadOnly: _propTypes["default"].bool,
|
|
@@ -302,6 +306,7 @@ var SelectWithIcon_propTypes = {
|
|
|
302
306
|
removeClose: _propTypes["default"].func,
|
|
303
307
|
searchBoxPlaceHolder: _propTypes["default"].string,
|
|
304
308
|
searchEmptyMessage: _propTypes["default"].string,
|
|
309
|
+
secondaryValueKey: _propTypes["default"].string,
|
|
305
310
|
selectedId: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
306
311
|
selectedValue: _propTypes["default"].string,
|
|
307
312
|
size: _propTypes["default"].oneOf(['small', 'medium']),
|
|
@@ -326,6 +331,7 @@ var SelectWithIcon_propTypes = {
|
|
|
326
331
|
customProps: _propTypes["default"].shape({
|
|
327
332
|
TextBoxProps: _propTypes["default"].object,
|
|
328
333
|
DropdownSearchTextBoxProps: _propTypes["default"].object,
|
|
334
|
+
SuggestionsProps: _propTypes["default"].object,
|
|
329
335
|
TextBoxIconProps: _propTypes["default"].object
|
|
330
336
|
})
|
|
331
337
|
};
|
package/lib/utils/Common.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DUMMY_OBJECT = void 0;
|
|
6
|
+
exports.DUMMY_OBJECT = exports.DUMMY_ARRAY = void 0;
|
|
7
7
|
exports.bind = bind;
|
|
8
8
|
exports.bytesToSize = bytesToSize;
|
|
9
9
|
exports.cancelBubblingEffect = cancelBubblingEffect;
|
|
@@ -516,4 +516,6 @@ function isTextSelected() {
|
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
var DUMMY_OBJECT = {};
|
|
519
|
-
exports.DUMMY_OBJECT = DUMMY_OBJECT;
|
|
519
|
+
exports.DUMMY_OBJECT = DUMMY_OBJECT;
|
|
520
|
+
var DUMMY_ARRAY = [];
|
|
521
|
+
exports.DUMMY_ARRAY = DUMMY_ARRAY;
|
|
@@ -152,8 +152,14 @@ var getListItemProps = function getListItemProps(props) {
|
|
|
152
152
|
return props.listItemProps || '';
|
|
153
153
|
};
|
|
154
154
|
|
|
155
|
+
var getlistItemCustomProps = function getlistItemCustomProps(props) {
|
|
156
|
+
return props.listItemCustomProps || dummyObj;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var defaultSearchFields = ['value'];
|
|
160
|
+
|
|
155
161
|
var getSearchFields = function getSearchFields(props) {
|
|
156
|
-
return props.searchFields ||
|
|
162
|
+
return props.searchFields || defaultSearchFields;
|
|
157
163
|
}; // const isObjectContainsSearchString = (searchFields = [], searchStr = '', obj) => {
|
|
158
164
|
// const matchedFields = searchFields.filter(element => {
|
|
159
165
|
// return getSearchString(obj[element]).indexOf(searchStr) !== -1
|
|
@@ -263,7 +269,7 @@ var extractOptionIdFromJson = function extractOptionIdFromJson(id, localData) {
|
|
|
263
269
|
exports.extractOptionIdFromJson = extractOptionIdFromJson;
|
|
264
270
|
|
|
265
271
|
var makeFormatOptions = function makeFormatOptions() {
|
|
266
|
-
return (0, _reselect.createSelector)([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getAllowValueFallback, getSearchFields, getSecondaryField], function (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, allowValueFallback, searchFields, secondaryField) {
|
|
272
|
+
return (0, _reselect.createSelector)([getOptions, getValueField, getTextField, getImageField, getPrefixText, getIconName, getIconSize, getOptionType, getDisabledOptions, getListItemProps, getlistItemCustomProps, getAllowValueFallback, getSearchFields, getSecondaryField], function (options, valueField, textField, imageField, prefixText, iconName, iconSize, optionType, disabledOptions, listItemProps, listItemCustomProps, allowValueFallback, searchFields, secondaryField) {
|
|
267
273
|
var revampOptions = [];
|
|
268
274
|
var remvampOptionIds = [];
|
|
269
275
|
var normalizedAllOptions = {};
|
|
@@ -278,7 +284,8 @@ var makeFormatOptions = function makeFormatOptions() {
|
|
|
278
284
|
impOptionType = option.optionType,
|
|
279
285
|
impIconName = option.iconName,
|
|
280
286
|
impIconSize = option.iconSize,
|
|
281
|
-
listStyle = option.listItemProps
|
|
287
|
+
listStyle = option.listItemProps,
|
|
288
|
+
listStyleCustomProps = option.listItemCustomProps;
|
|
282
289
|
var id = _typeof(option) === 'object' ? option[impValueField || valueField] : option;
|
|
283
290
|
var value = _typeof(option) === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
284
291
|
var secondaryValue = _typeof(option) === 'object' ? option[impSecondaryField || secondaryField] : '';
|
|
@@ -323,6 +330,10 @@ var makeFormatOptions = function makeFormatOptions() {
|
|
|
323
330
|
optionDetails.listItemProps = listStyle || listItemProps;
|
|
324
331
|
}
|
|
325
332
|
|
|
333
|
+
if (listStyleCustomProps || listItemCustomProps) {
|
|
334
|
+
optionDetails.listItemCustomProps = listStyleCustomProps || listItemCustomProps;
|
|
335
|
+
}
|
|
336
|
+
|
|
326
337
|
normalizedFormatOptions[id] = optionDetails;
|
|
327
338
|
normalizedAllOptions[id] = _objectSpread(_objectSpread({}, option), {}, {
|
|
328
339
|
groupId: prefixText
|
|
@@ -478,7 +489,8 @@ var makeGetGroupSelectOptions = function makeGetGroupSelectOptions() {
|
|
|
478
489
|
groupId = group.id,
|
|
479
490
|
name = group.name,
|
|
480
491
|
valueField = group.valueField,
|
|
481
|
-
textField = group.textField
|
|
492
|
+
textField = group.textField,
|
|
493
|
+
secondaryField = group.secondaryField;
|
|
482
494
|
|
|
483
495
|
if (!(0, _Common.getIsEmptyValue)(groupId) && groupIds.indexOf(groupId) === -1) {
|
|
484
496
|
groupIds.push(groupId);
|
|
@@ -488,6 +500,7 @@ var makeGetGroupSelectOptions = function makeGetGroupSelectOptions() {
|
|
|
488
500
|
options: options,
|
|
489
501
|
valueField: valueField,
|
|
490
502
|
textField: textField,
|
|
503
|
+
secondaryField: secondaryField,
|
|
491
504
|
prefixText: groupId,
|
|
492
505
|
allowValueFallback: allowValueFallback
|
|
493
506
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-234",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"build:css:umd": "npm run clean && npm run init && react-cli build:css:umd",
|
|
40
40
|
"coverage": "react-cli coverage",
|
|
41
41
|
"prepare": "npm run init && npm run css:build ",
|
|
42
|
-
"prepublishOnly": "node prePublish.js npm run
|
|
42
|
+
"prepublishOnly": "node prePublish.js && npm run css:review",
|
|
43
43
|
"postpublish": "node postPublish.js",
|
|
44
44
|
"report": "react-cli publish:report",
|
|
45
45
|
"test": "react-cli test",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@testing-library/react": "^11.2.5",
|
|
74
74
|
"@testing-library/react-hooks": "^7.0.2",
|
|
75
75
|
"@testing-library/user-event": "^13.0.10",
|
|
76
|
-
"@zohodesk-private/color-variable-preprocessor": "1.
|
|
76
|
+
"@zohodesk-private/color-variable-preprocessor": "1.2.0",
|
|
77
77
|
"@zohodesk-private/css-variable-migrator": "1.0.9",
|
|
78
78
|
"@zohodesk-private/node-plugins": "1.1.13",
|
|
79
79
|
"@zohodesk-private/react-prop-validator": "1.2.3",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@zohodesk/svg": "1.2.2",
|
|
87
87
|
"@zohodesk/utils": "1.3.14",
|
|
88
88
|
"@zohodesk/variables": "1.1.0",
|
|
89
|
-
"@zohodesk/virtualizer": "1.0.
|
|
89
|
+
"@zohodesk/virtualizer": "1.0.13",
|
|
90
90
|
"react-sortable-hoc": "^0.8.3",
|
|
91
91
|
"velocity-react": "1.4.3",
|
|
92
92
|
"@zohodesk/react-cli": "1.1.27"
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@zohodesk/icons": "1.1.0",
|
|
102
102
|
"@zohodesk/variables": "1.1.0",
|
|
103
103
|
"@zohodesk/svg": "1.2.2",
|
|
104
|
-
"@zohodesk/virtualizer": "1.0.
|
|
104
|
+
"@zohodesk/virtualizer": "1.0.13",
|
|
105
105
|
"velocity-react": "1.4.3",
|
|
106
106
|
"react-sortable-hoc": "^0.8.3",
|
|
107
107
|
"@zohodesk/hooks": "2.0.5",
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
"@zohodesk/layout": "3.1.0",
|
|
111
111
|
"@zohodesk/dotkit": "1.0.3"
|
|
112
112
|
}
|
|
113
|
-
}
|
|
113
|
+
}
|