@zohodesk/components 1.4.10-exp.1 → 1.4.11
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 +13 -0
- package/es/AppContainer/AppContainer.js +0 -1
- package/es/AppContainer/AppContainer.module.css +2 -3
- package/es/Button/css/Button.module.css +4 -13
- package/es/DateTime/DateTime.module.css +9 -12
- package/es/DateTime/YearView.module.css +1 -1
- package/es/Heading/Heading.module.css +1 -0
- package/es/Label/Label.module.css +8 -8
- package/es/MultiSelect/MultiSelect.js +36 -12
- package/es/MultiSelect/MultiSelect.module.css +1 -1
- 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/Select.js +41 -12
- package/es/Select/props/defaultProps.js +1 -0
- package/es/Select/props/propTypes.js +1 -0
- package/es/Tab/Tabs.module.css +1 -1
- package/es/TextBox/TextBox.module.css +4 -4
- package/es/Textarea/Textarea.module.css +1 -1
- package/es/Tooltip/Tooltip.module.css +1 -1
- package/es/Typography/css/Typography.module.css +4 -4
- package/es/common/basic.module.css +6 -39
- package/es/common/basicReset.module.css +2 -2
- package/es/common/common.module.css +5 -5
- package/es/utils/Common.js +2 -1
- package/es/utils/dropDownUtils.js +3 -1
- package/es/v1/Tab/v1Tabs.module.css +1 -1
- package/es/v1/Typography/css/v1_Typography.module.css +4 -4
- package/lib/AppContainer/AppContainer.js +0 -2
- package/lib/AppContainer/AppContainer.module.css +2 -3
- package/lib/Button/css/Button.module.css +4 -13
- package/lib/DateTime/DateTime.module.css +9 -12
- package/lib/DateTime/YearView.module.css +1 -1
- package/lib/Heading/Heading.module.css +1 -0
- package/lib/Label/Label.module.css +8 -8
- package/lib/MultiSelect/MultiSelect.js +36 -10
- package/lib/MultiSelect/MultiSelect.module.css +1 -1
- 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/Select.js +40 -9
- package/lib/Select/props/defaultProps.js +1 -0
- package/lib/Select/props/propTypes.js +1 -0
- package/lib/Tab/Tabs.module.css +1 -1
- package/lib/TextBox/TextBox.module.css +4 -4
- package/lib/Textarea/Textarea.module.css +1 -1
- package/lib/Tooltip/Tooltip.module.css +1 -1
- package/lib/Typography/css/Typography.module.css +4 -4
- package/lib/common/basic.module.css +6 -39
- package/lib/common/basicReset.module.css +2 -2
- package/lib/common/common.module.css +5 -5
- package/lib/utils/Common.js +4 -2
- package/lib/utils/dropDownUtils.js +3 -1
- package/lib/v1/Tab/v1Tabs.module.css +1 -1
- package/lib/v1/Typography/css/v1_Typography.module.css +4 -4
- package/package.json +5 -5
|
@@ -162,6 +162,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
162
162
|
_this.handleSearchOptions = (0, _Common.debounce)(_this.handleSearchOptions.bind(_assertThisInitialized(_this)), searchDebounceTime);
|
|
163
163
|
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
|
164
164
|
_this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
|
|
165
|
+
_this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
|
|
166
|
+
_this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
|
|
165
167
|
return _this;
|
|
166
168
|
}
|
|
167
169
|
|
|
@@ -227,9 +229,6 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
227
229
|
}, {
|
|
228
230
|
key: "componentDidUpdate",
|
|
229
231
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
230
|
-
var suggestionContainer = this.suggestionContainer,
|
|
231
|
-
selectedOptionContainer = this.selectedOptionContainer,
|
|
232
|
-
suggestionsOrder = this.suggestionsOrder;
|
|
233
232
|
var _this$state = this.state,
|
|
234
233
|
hoverOption = _this$state.hoverOption,
|
|
235
234
|
highLightedSelectOptions = _this$state.highLightedSelectOptions,
|
|
@@ -240,7 +239,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
240
239
|
isPopupOpen = _this$props2.isPopupOpen,
|
|
241
240
|
onDropBoxClose = _this$props2.onDropBoxClose,
|
|
242
241
|
onDropBoxOpen = _this$props2.onDropBoxOpen,
|
|
243
|
-
isSearchClearOnClose = _this$props2.isSearchClearOnClose
|
|
242
|
+
isSearchClearOnClose = _this$props2.isSearchClearOnClose,
|
|
243
|
+
isVirtualizerEnabled = _this$props2.isVirtualizerEnabled; //handle dropbox open & close
|
|
244
244
|
|
|
245
245
|
if (prevProps.isPopupOpen !== isPopupOpen) {
|
|
246
246
|
isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
|
|
@@ -255,12 +255,21 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
255
255
|
} //scrollTo handling
|
|
256
256
|
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
258
|
+
if (isVirtualizerEnabled && !!this.virtualizerMethods) {
|
|
259
|
+
var position = prevState.hoverOption > hoverOption ? 'top' : 'bottom';
|
|
260
|
+
this.virtualizerMethods.getElementVisiblePercentage(hoverOption) < 50 && this.virtualizerMethods.scrollToIndex(hoverOption, position);
|
|
261
|
+
} else {
|
|
262
|
+
var suggestionContainer = this.suggestionContainer,
|
|
263
|
+
selectedOptionContainer = this.selectedOptionContainer,
|
|
264
|
+
suggestionsOrder = this.suggestionsOrder;
|
|
265
|
+
var hoverId = suggestionsOrder[hoverOption] || '';
|
|
266
|
+
var selectedSuggestion = this["suggestion_".concat(hoverId)];
|
|
267
|
+
var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
|
|
268
|
+
var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
|
|
269
|
+
isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
|
|
270
|
+
selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
|
|
271
|
+
} //When suggestions length less than 5, getNextOptions function call
|
|
272
|
+
|
|
264
273
|
|
|
265
274
|
var _this$props3 = this.props,
|
|
266
275
|
isNextOptions = _this$props3.isNextOptions,
|
|
@@ -880,6 +889,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
880
889
|
key: "suggestionContainerRef",
|
|
881
890
|
value: function suggestionContainerRef(el) {
|
|
882
891
|
this.suggestionContainer = el;
|
|
892
|
+
typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
|
|
883
893
|
}
|
|
884
894
|
}, {
|
|
885
895
|
key: "suggestionItemRef",
|
|
@@ -942,6 +952,17 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
942
952
|
openPopupOnly: openPopupOnly
|
|
943
953
|
});
|
|
944
954
|
}
|
|
955
|
+
}, {
|
|
956
|
+
key: "getVirtualizerPublicMethods",
|
|
957
|
+
value: function getVirtualizerPublicMethods(methods) {
|
|
958
|
+
this.virtualizerMethods = methods;
|
|
959
|
+
}
|
|
960
|
+
}, {
|
|
961
|
+
key: "setSuggestionsVirtualizerContainerRefFunction",
|
|
962
|
+
value: function setSuggestionsVirtualizerContainerRefFunction(refFunc) {
|
|
963
|
+
this.setSuggestionsVirtualizerRef = refFunc;
|
|
964
|
+
this.suggestionContainer && refFunc(this.suggestionContainer);
|
|
965
|
+
}
|
|
945
966
|
}, {
|
|
946
967
|
key: "getSelectionUI",
|
|
947
968
|
value: function getSelectionUI() {
|
|
@@ -1119,6 +1140,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1119
1140
|
isLoading = _this$props15.isLoading,
|
|
1120
1141
|
selectAllText = _this$props15.selectAllText,
|
|
1121
1142
|
needSelectAll = _this$props15.needSelectAll,
|
|
1143
|
+
isVirtualizerEnabled = _this$props15.isVirtualizerEnabled,
|
|
1122
1144
|
limit = _this$props15.limit;
|
|
1123
1145
|
var _this$state9 = this.state,
|
|
1124
1146
|
selectedOptions = _this$state9.selectedOptions,
|
|
@@ -1199,7 +1221,11 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1199
1221
|
}, isSearching ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1200
1222
|
className: _MultiSelectModule["default"][palette]
|
|
1201
1223
|
}, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
|
|
1224
|
+
key: searchStr.trim(),
|
|
1202
1225
|
suggestions: suggestions,
|
|
1226
|
+
isVirtualizerEnabled: isVirtualizerEnabled,
|
|
1227
|
+
getVirtualizerPublicMethods: this.getVirtualizerPublicMethods,
|
|
1228
|
+
setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
|
|
1203
1229
|
getRef: this.suggestionItemRef,
|
|
1204
1230
|
hoverOption: hoverOption,
|
|
1205
1231
|
onClick: this.handleSelectOption,
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
.more {
|
|
197
197
|
font-size: var(--zd_font_size14) ;
|
|
198
198
|
color: var(--zdt_multiselect_more_text);
|
|
199
|
-
font-
|
|
199
|
+
font-family: inherit;
|
|
200
200
|
cursor: pointer;
|
|
201
201
|
margin-top: var(--zd_size5) ;
|
|
202
202
|
background-color: var(--zdt_multiselect_delete_bg);
|
|
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
12
|
var _propTypes = require("./props/propTypes");
|
|
13
13
|
|
|
14
14
|
var _defaultProps = require("./props/defaultProps");
|
|
15
15
|
|
|
16
|
+
var _virtualizer = require("@zohodesk/virtualizer");
|
|
17
|
+
|
|
16
18
|
var _ListItem = _interopRequireDefault(require("../ListItem/ListItem"));
|
|
17
19
|
|
|
18
20
|
var _ListItemWithAvatar = _interopRequireDefault(require("../ListItem/ListItemWithAvatar"));
|
|
@@ -21,8 +23,14 @@ var _ListItemWithIcon = _interopRequireDefault(require("../ListItem/ListItemWith
|
|
|
21
23
|
|
|
22
24
|
var _Layout = require("../Layout");
|
|
23
25
|
|
|
26
|
+
var _Common = require("../utils/Common");
|
|
27
|
+
|
|
24
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
29
|
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
26
34
|
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); }
|
|
27
35
|
|
|
28
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -51,22 +59,39 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
51
59
|
|
|
52
60
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
61
|
|
|
62
|
+
function SuggestionsVirtualizerContainer(_ref) {
|
|
63
|
+
var eleRef = _ref.eleRef,
|
|
64
|
+
children = _ref.children,
|
|
65
|
+
setVirtualizerContainerRefFunction = _ref.setVirtualizerContainerRefFunction;
|
|
66
|
+
(0, _react.useMemo)(function () {
|
|
67
|
+
typeof setVirtualizerContainerRefFunction === 'function' && setVirtualizerContainerRefFunction(eleRef);
|
|
68
|
+
}, [eleRef, setVirtualizerContainerRefFunction]);
|
|
69
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
55
73
|
_inherits(Suggestions, _React$PureComponent);
|
|
56
74
|
|
|
57
75
|
var _super = _createSuper(Suggestions);
|
|
58
76
|
|
|
59
|
-
function Suggestions() {
|
|
77
|
+
function Suggestions(props) {
|
|
78
|
+
var _this;
|
|
79
|
+
|
|
60
80
|
_classCallCheck(this, Suggestions);
|
|
61
81
|
|
|
62
|
-
|
|
82
|
+
_this = _super.call(this, props);
|
|
83
|
+
_this.renderSuggestionList = _this.renderSuggestionList.bind(_assertThisInitialized(_this));
|
|
84
|
+
_this.renderVirtualizerSuggestionListItem = _this.renderVirtualizerSuggestionListItem.bind(_assertThisInitialized(_this));
|
|
85
|
+
return _this;
|
|
63
86
|
}
|
|
64
87
|
|
|
65
88
|
_createClass(Suggestions, [{
|
|
66
|
-
key: "
|
|
67
|
-
value: function
|
|
89
|
+
key: "renderSuggestionList",
|
|
90
|
+
value: function renderSuggestionList(_ref2) {
|
|
91
|
+
var suggestion = _ref2.suggestion,
|
|
92
|
+
index = _ref2.index,
|
|
93
|
+
ref = _ref2.ref;
|
|
68
94
|
var _this$props = this.props,
|
|
69
|
-
suggestions = _this$props.suggestions,
|
|
70
95
|
getRef = _this$props.getRef,
|
|
71
96
|
hoverOption = _this$props.hoverOption,
|
|
72
97
|
onClick = _this$props.onClick,
|
|
@@ -74,118 +99,69 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
74
99
|
needTick = _this$props.needTick,
|
|
75
100
|
needBorder = _this$props.needBorder,
|
|
76
101
|
_this$props$selectedO = _this$props.selectedOptions,
|
|
77
|
-
selectedOptions = _this$props$selectedO === void 0 ?
|
|
102
|
+
selectedOptions = _this$props$selectedO === void 0 ? _Common.DUMMY_ARRAY : _this$props$selectedO,
|
|
78
103
|
activeId = _this$props.activeId,
|
|
79
104
|
hoverId = _this$props.hoverId,
|
|
80
|
-
dataId = _this$props.dataId,
|
|
81
105
|
listItemSize = _this$props.listItemSize,
|
|
82
|
-
className = _this$props.className,
|
|
83
106
|
avatarPalette = _this$props.avatarPalette,
|
|
84
107
|
palette = _this$props.palette,
|
|
85
|
-
htmlId = _this$props.htmlId,
|
|
86
108
|
a11y = _this$props.a11y,
|
|
87
109
|
needMultiLineText = _this$props.needMultiLineText,
|
|
88
110
|
limit = _this$props.limit,
|
|
89
111
|
limitReachedMessage = _this$props.limitReachedMessage;
|
|
90
|
-
var
|
|
91
|
-
|
|
112
|
+
var id = suggestion.id,
|
|
113
|
+
value = suggestion.value,
|
|
114
|
+
secondaryValue = suggestion.secondaryValue,
|
|
115
|
+
photoURL = suggestion.photoURL,
|
|
116
|
+
icon = suggestion.icon,
|
|
117
|
+
optionType = suggestion.optionType,
|
|
118
|
+
iconSize = suggestion.iconSize,
|
|
119
|
+
isDisabled = suggestion.isDisabled,
|
|
120
|
+
listItemProps = suggestion.listItemProps,
|
|
121
|
+
_suggestion$listItemC = suggestion.listItemCustomProps,
|
|
122
|
+
listItemCustomProps = _suggestion$listItemC === void 0 ? _Common.DUMMY_OBJECT : _suggestion$listItemC;
|
|
123
|
+
var isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
|
|
124
|
+
var isHighlight = hoverOption === index || id === hoverId ? true : false;
|
|
92
125
|
var selectedOptionsLength = selectedOptions.length;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
'data-a11y-list-active': isHighlight
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
var commonProps = _objectSpread({
|
|
124
|
-
isDisabled: isDisabled ? isDisabled : isLimitReached,
|
|
125
|
-
needMultiLineText: needMultiLineText
|
|
126
|
-
}, listItemCustomProps);
|
|
127
|
-
|
|
128
|
-
if (listItemProps) {
|
|
129
|
-
commonProps.customProps = {
|
|
130
|
-
ListItemProps: _objectSpread({}, listItemProps)
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (isLimitReached) {
|
|
135
|
-
commonProps.disableTitle = limitReachedMessage;
|
|
126
|
+
var isLimitReached = selectedOptionsLength >= limit && !isActive;
|
|
127
|
+
var list_a11y = Object.assign({}, a11y, {
|
|
128
|
+
ariaSelected: isActive,
|
|
129
|
+
ariaLabel: value,
|
|
130
|
+
'data-a11y-list-active': isHighlight
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var commonProps = _objectSpread({
|
|
134
|
+
isDisabled: isDisabled ? isDisabled : isLimitReached,
|
|
135
|
+
needMultiLineText: needMultiLineText
|
|
136
|
+
}, listItemCustomProps);
|
|
137
|
+
|
|
138
|
+
if (listItemProps) {
|
|
139
|
+
commonProps.customProps = {
|
|
140
|
+
ListItemProps: _objectSpread({}, listItemProps)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (isLimitReached) {
|
|
145
|
+
commonProps.disableTitle = limitReachedMessage;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function getListItemRef(ele, index, id) {
|
|
149
|
+
ref && ref(ele);
|
|
150
|
+
|
|
151
|
+
if (typeof getRef === 'function') {
|
|
152
|
+
getRef(ele, index, id);
|
|
136
153
|
}
|
|
154
|
+
}
|
|
137
155
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
autoHover: false,
|
|
141
|
-
getRef: getRef,
|
|
142
|
-
highlight: isHighlight,
|
|
143
|
-
id: id,
|
|
144
|
-
imgSrc: photoURL,
|
|
145
|
-
key: "".concat(id, "avatarListItem"),
|
|
146
|
-
name: value,
|
|
147
|
-
onClick: onClick,
|
|
148
|
-
onMouseEnter: onMouseEnter,
|
|
149
|
-
value: value,
|
|
150
|
-
title: value,
|
|
151
|
-
needTick: needTick,
|
|
152
|
-
needBorder: needBorder,
|
|
153
|
-
active: isActive,
|
|
154
|
-
size: listItemSize,
|
|
155
|
-
avatarPalette: avatarPalette,
|
|
156
|
-
palette: palette,
|
|
157
|
-
a11y: list_a11y,
|
|
158
|
-
secondaryValue: secondaryValue
|
|
159
|
-
}));
|
|
160
|
-
} else if (optionType === 'icon') {
|
|
161
|
-
return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({}, commonProps, {
|
|
162
|
-
autoHover: false,
|
|
163
|
-
getRef: getRef,
|
|
164
|
-
highlight: isHighlight,
|
|
165
|
-
id: id,
|
|
166
|
-
key: "".concat(id, "iconListItem"),
|
|
167
|
-
onClick: onClick,
|
|
168
|
-
onMouseEnter: onMouseEnter,
|
|
169
|
-
value: value,
|
|
170
|
-
title: value,
|
|
171
|
-
iconName: icon,
|
|
172
|
-
needTick: needTick,
|
|
173
|
-
needBorder: needBorder,
|
|
174
|
-
active: isActive,
|
|
175
|
-
iconSize: iconSize,
|
|
176
|
-
size: listItemSize,
|
|
177
|
-
palette: palette,
|
|
178
|
-
a11y: list_a11y,
|
|
179
|
-
secondaryValue: secondaryValue
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({}, commonProps, {
|
|
156
|
+
if (optionType === 'avatar') {
|
|
157
|
+
return /*#__PURE__*/_react["default"].createElement(_ListItemWithAvatar["default"], _extends({}, commonProps, {
|
|
184
158
|
autoHover: false,
|
|
185
|
-
getRef:
|
|
159
|
+
getRef: getListItemRef,
|
|
186
160
|
highlight: isHighlight,
|
|
187
161
|
id: id,
|
|
188
|
-
|
|
162
|
+
imgSrc: photoURL,
|
|
163
|
+
key: "".concat(id, "avatarListItem"),
|
|
164
|
+
name: value,
|
|
189
165
|
onClick: onClick,
|
|
190
166
|
onMouseEnter: onMouseEnter,
|
|
191
167
|
value: value,
|
|
@@ -194,9 +170,103 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
194
170
|
needBorder: needBorder,
|
|
195
171
|
active: isActive,
|
|
196
172
|
size: listItemSize,
|
|
173
|
+
avatarPalette: avatarPalette,
|
|
197
174
|
palette: palette,
|
|
198
|
-
a11y: list_a11y
|
|
175
|
+
a11y: list_a11y,
|
|
176
|
+
secondaryValue: secondaryValue
|
|
199
177
|
}));
|
|
178
|
+
} else if (optionType === 'icon') {
|
|
179
|
+
return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({}, commonProps, {
|
|
180
|
+
autoHover: false,
|
|
181
|
+
getRef: getListItemRef,
|
|
182
|
+
highlight: isHighlight,
|
|
183
|
+
id: id,
|
|
184
|
+
key: "".concat(id, "iconListItem"),
|
|
185
|
+
onClick: onClick,
|
|
186
|
+
onMouseEnter: onMouseEnter,
|
|
187
|
+
value: value,
|
|
188
|
+
title: value,
|
|
189
|
+
iconName: icon,
|
|
190
|
+
needTick: needTick,
|
|
191
|
+
needBorder: needBorder,
|
|
192
|
+
active: isActive,
|
|
193
|
+
iconSize: iconSize,
|
|
194
|
+
size: listItemSize,
|
|
195
|
+
palette: palette,
|
|
196
|
+
a11y: list_a11y,
|
|
197
|
+
secondaryValue: secondaryValue
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({}, commonProps, {
|
|
202
|
+
autoHover: false,
|
|
203
|
+
getRef: getListItemRef,
|
|
204
|
+
highlight: isHighlight,
|
|
205
|
+
id: id,
|
|
206
|
+
key: "".concat(id, "listItem"),
|
|
207
|
+
onClick: onClick,
|
|
208
|
+
onMouseEnter: onMouseEnter,
|
|
209
|
+
value: value,
|
|
210
|
+
title: value,
|
|
211
|
+
needTick: needTick,
|
|
212
|
+
needBorder: needBorder,
|
|
213
|
+
active: isActive,
|
|
214
|
+
size: listItemSize,
|
|
215
|
+
palette: palette,
|
|
216
|
+
a11y: list_a11y
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
}, {
|
|
220
|
+
key: "renderVirtualizerSuggestionListItem",
|
|
221
|
+
value: function renderVirtualizerSuggestionListItem(_ref3) {
|
|
222
|
+
var index = _ref3.index,
|
|
223
|
+
ref = _ref3.ref;
|
|
224
|
+
var suggestions = this.props.suggestions;
|
|
225
|
+
var suggestion = suggestions[index];
|
|
226
|
+
return this.renderSuggestionList({
|
|
227
|
+
suggestion: suggestion,
|
|
228
|
+
index: index,
|
|
229
|
+
ref: ref
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
key: "render",
|
|
234
|
+
value: function render() {
|
|
235
|
+
var _this2 = this;
|
|
236
|
+
|
|
237
|
+
var _this$props2 = this.props,
|
|
238
|
+
suggestions = _this$props2.suggestions,
|
|
239
|
+
dataId = _this$props2.dataId,
|
|
240
|
+
className = _this$props2.className,
|
|
241
|
+
isVirtualizerEnabled = _this$props2.isVirtualizerEnabled,
|
|
242
|
+
htmlId = _this$props2.htmlId,
|
|
243
|
+
a11y = _this$props2.a11y,
|
|
244
|
+
getVirtualizerPublicMethods = _this$props2.getVirtualizerPublicMethods,
|
|
245
|
+
setVirtualizerContainerRefFunction = _this$props2.setVirtualizerContainerRefFunction;
|
|
246
|
+
var ariaParentRole = a11y.ariaParentRole,
|
|
247
|
+
ariaMultiselectable = a11y.ariaMultiselectable;
|
|
248
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
249
|
+
isCover: false,
|
|
250
|
+
role: ariaParentRole,
|
|
251
|
+
id: htmlId,
|
|
252
|
+
tabindex: "0",
|
|
253
|
+
"aria-multiselectable": ariaMultiselectable
|
|
254
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
255
|
+
dataId: "".concat(dataId),
|
|
256
|
+
className: className ? className : ''
|
|
257
|
+
}, isVirtualizerEnabled ? /*#__PURE__*/_react["default"].createElement(_virtualizer.Virtualizer, {
|
|
258
|
+
containerType: SuggestionsVirtualizerContainer,
|
|
259
|
+
elementRenderer: this.renderVirtualizerSuggestionListItem,
|
|
260
|
+
getExposedPublicMethods: getVirtualizerPublicMethods,
|
|
261
|
+
elementsCount: suggestions.length,
|
|
262
|
+
isElementsFixedHeight: false,
|
|
263
|
+
dataId: "".concat(dataId, "_virtualizer"),
|
|
264
|
+
setVirtualizerContainerRefFunction: setVirtualizerContainerRefFunction
|
|
265
|
+
}) : suggestions.map(function (suggestion, index) {
|
|
266
|
+
return _this2.renderSuggestionList({
|
|
267
|
+
suggestion: suggestion,
|
|
268
|
+
index: index
|
|
269
|
+
});
|
|
200
270
|
})));
|
|
201
271
|
}
|
|
202
272
|
}]);
|
|
@@ -97,6 +97,7 @@ var MultiSelect_defaultProps = {
|
|
|
97
97
|
autoComplete: (0, _Config.getLibraryConfig)('autoComplete'),
|
|
98
98
|
dataId: 'multiSelect',
|
|
99
99
|
dropBoxSize: 'small',
|
|
100
|
+
isVirtualizerEnabled: false,
|
|
100
101
|
isAnimate: true,
|
|
101
102
|
isDisabled: false,
|
|
102
103
|
isPopupOpenOnEnter: false,
|
|
@@ -182,6 +183,7 @@ var SelectedOptions_defaultProps = {
|
|
|
182
183
|
exports.SelectedOptions_defaultProps = SelectedOptions_defaultProps;
|
|
183
184
|
var Suggestions_defaultProps = {
|
|
184
185
|
a11y: {},
|
|
186
|
+
isVirtualizerEnabled: false,
|
|
185
187
|
needMultiLineText: false
|
|
186
188
|
};
|
|
187
189
|
exports.Suggestions_defaultProps = Suggestions_defaultProps;
|
|
@@ -50,6 +50,7 @@ var MultiSelect_propTypes = {
|
|
|
50
50
|
disableAction: _propTypes["default"].bool,
|
|
51
51
|
dropBoxSize: _propTypes["default"].oneOf(['small', 'medium', 'large']),
|
|
52
52
|
emptyMessage: _propTypes["default"].string.isRequired,
|
|
53
|
+
isVirtualizerEnabled: _propTypes["default"].bool,
|
|
53
54
|
getContainerRef: _propTypes["default"].func,
|
|
54
55
|
getNextOptions: _propTypes["default"].func,
|
|
55
56
|
getPublicMethods: _propTypes["default"].func,
|
|
@@ -192,6 +193,9 @@ var Suggestions_propTypes = {
|
|
|
192
193
|
avatarPalette: _propTypes["default"].string,
|
|
193
194
|
className: _propTypes["default"].string,
|
|
194
195
|
dataId: _propTypes["default"].string,
|
|
196
|
+
isVirtualizerEnabled: _propTypes["default"].bool,
|
|
197
|
+
setVirtualizerContainerRefFunction: _propTypes["default"].func,
|
|
198
|
+
getVirtualizerPublicMethods: _propTypes["default"].func,
|
|
195
199
|
getRef: _propTypes["default"].func,
|
|
196
200
|
hoverId: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
197
201
|
hoverOption: _propTypes["default"].number,
|
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,9 +323,9 @@ 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;
|
|
313
327
|
var _customProps$listItem = customProps.listItemProps,
|
|
314
|
-
listItemProps = _customProps$listItem === void 0 ?
|
|
328
|
+
listItemProps = _customProps$listItem === void 0 ? _dropDownUtils.dummyObj : _customProps$listItem;
|
|
315
329
|
return this.formatOptions({
|
|
316
330
|
options: options,
|
|
317
331
|
valueField: valueField,
|
|
@@ -574,6 +588,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
574
588
|
key: "suggestionContainerRef",
|
|
575
589
|
value: function suggestionContainerRef(el) {
|
|
576
590
|
this.suggestionContainer = el;
|
|
591
|
+
typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
|
|
577
592
|
}
|
|
578
593
|
}, {
|
|
579
594
|
key: "suggestionItemRef",
|
|
@@ -721,6 +736,17 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
721
736
|
onAddNewOption: this.handleAddNewOption
|
|
722
737
|
});
|
|
723
738
|
}
|
|
739
|
+
}, {
|
|
740
|
+
key: "getVirtualizerPublicMethods",
|
|
741
|
+
value: function getVirtualizerPublicMethods(methods) {
|
|
742
|
+
this.virtualizerMethods = methods;
|
|
743
|
+
}
|
|
744
|
+
}, {
|
|
745
|
+
key: "setSuggestionsVirtualizerContainerRefFunction",
|
|
746
|
+
value: function setSuggestionsVirtualizerContainerRefFunction(refFunc) {
|
|
747
|
+
this.setSuggestionsVirtualizerRef = refFunc;
|
|
748
|
+
this.suggestionContainer && refFunc(this.suggestionContainer);
|
|
749
|
+
}
|
|
724
750
|
}, {
|
|
725
751
|
key: "render",
|
|
726
752
|
value: function render() {
|
|
@@ -777,6 +803,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
777
803
|
targetOffset = _this$props11.targetOffset,
|
|
778
804
|
isRestrictScroll = _this$props11.isRestrictScroll,
|
|
779
805
|
dropBoxPortalId = _this$props11.dropBoxPortalId,
|
|
806
|
+
isVirtualizerEnabled = _this$props11.isVirtualizerEnabled,
|
|
780
807
|
renderCustomToggleIndicator = _this$props11.renderCustomToggleIndicator,
|
|
781
808
|
renderCustomSearchClearComponent = _this$props11.renderCustomSearchClearComponent;
|
|
782
809
|
var _i18nKeys = i18nKeys,
|
|
@@ -975,7 +1002,11 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
|
|
|
975
1002
|
customClass: !tabletMode && dropBoxSize ? _SelectModule["default"][dropBoxSize] : '',
|
|
976
1003
|
eleRef: _this7.suggestionContainerRef
|
|
977
1004
|
}, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
|
|
1005
|
+
key: searchStr.trim(),
|
|
978
1006
|
activeId: selectedId,
|
|
1007
|
+
isVirtualizerEnabled: isVirtualizerEnabled,
|
|
1008
|
+
getVirtualizerPublicMethods: _this7.getVirtualizerPublicMethods,
|
|
1009
|
+
setVirtualizerContainerRefFunction: _this7.setSuggestionsVirtualizerContainerRefFunction,
|
|
979
1010
|
suggestions: suggestions,
|
|
980
1011
|
getRef: _this7.suggestionItemRef,
|
|
981
1012
|
hoverOption: hoverIndex,
|
|
@@ -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,
|
package/lib/Tab/Tabs.module.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--textbox_width: 100%;
|
|
10
10
|
--textbox_height: var(--zd_size35);
|
|
11
11
|
--textbox_border_radius: none;
|
|
12
|
-
--
|
|
12
|
+
--textbox_font_family: var(--zd_regular);
|
|
13
13
|
/* Variable:Ignore */
|
|
14
14
|
--textbox_letter_spacing: 0.1px;
|
|
15
15
|
--textbox_padding: 0;
|
|
@@ -166,18 +166,18 @@
|
|
|
166
166
|
.primary,
|
|
167
167
|
.secondary,
|
|
168
168
|
.light {
|
|
169
|
-
font-
|
|
169
|
+
font-family: var(--textbox_font_family);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
.primary {
|
|
173
173
|
--textbox_text_color: var(--zdt_textbox_default_text);
|
|
174
|
-
--
|
|
174
|
+
--textbox_font_family: var(--zd_semibold);
|
|
175
175
|
composes: ftsmooth from '../common/common.module.css';
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
.secondary {
|
|
179
179
|
--textbox_text_color: var(--zdt_textbox_secondary_text);
|
|
180
|
-
--
|
|
180
|
+
--textbox_font_family: var(--zd_light);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
.light {
|