linear-react-components-ui 1.0.12-beta.6 → 1.0.12-beta.7
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.
|
@@ -164,20 +164,20 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
164
164
|
if (!currents.includes(selected)) onSelect(selected);
|
|
165
165
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
166
166
|
if (!opened) setOpened(true);
|
|
167
|
-
var index =
|
|
167
|
+
var index = dataCombo ? dataCombo.findIndex(function (d) {
|
|
168
168
|
return d === selected;
|
|
169
169
|
}) : 0;
|
|
170
170
|
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
171
|
-
index =
|
|
171
|
+
index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
|
|
172
172
|
} else {
|
|
173
|
-
index =
|
|
173
|
+
index = dataCombo && index === 0 ? dataCombo.length - 1 : index - 1;
|
|
174
174
|
}
|
|
175
|
-
if (
|
|
176
|
-
if (descriptionKeyIsString &&
|
|
177
|
-
setInputValue(
|
|
178
|
-
} else if (!descriptionKeyIsString) setInputValue([descriptionKey(
|
|
175
|
+
if (dataCombo && dataCombo.length) {
|
|
176
|
+
if (descriptionKeyIsString && dataCombo[index][descriptionKey]) {
|
|
177
|
+
setInputValue(dataCombo[index][descriptionKey]);
|
|
178
|
+
} else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataCombo[index])]);
|
|
179
179
|
}
|
|
180
|
-
if (
|
|
180
|
+
if (dataCombo) setSelected(dataCombo[index]);
|
|
181
181
|
} else if (e.keyCode === constants.keyCodes.BACKSPACE) {
|
|
182
182
|
if (inputValue.length === 0) {
|
|
183
183
|
var currentsKeyDown = _lodash.default.dropRight(currents);
|