@longline/aqua-ui 1.0.103 → 1.0.104
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.
|
@@ -183,7 +183,7 @@ var DropdownBase = function (props) {
|
|
|
183
183
|
var selectItemByCharacter = function (c) {
|
|
184
184
|
c = c.toLowerCase();
|
|
185
185
|
// Go through all (non-null) data records:
|
|
186
|
-
var idx = props.data.filter(function (r) { return r != null; }).findIndex(function (row) {
|
|
186
|
+
var idx = (props.data || []).filter(function (r) { return r != null; }).findIndex(function (row) {
|
|
187
187
|
// Build a list of strings contained in the data row:
|
|
188
188
|
var strings = [];
|
|
189
189
|
// If data row is an object, convert all its keys to string.
|
|
@@ -199,10 +199,12 @@ var DropdownBase = function (props) {
|
|
|
199
199
|
});
|
|
200
200
|
// Was a matching row found?
|
|
201
201
|
if (idx != -1) {
|
|
202
|
-
handleClick(props.data[idx]);
|
|
202
|
+
handleClick((props.data || [])[idx]);
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
var selectPreviousItem = function () {
|
|
206
|
+
if (!props.data)
|
|
207
|
+
return;
|
|
206
208
|
var prevIndex = props.data.indexOf(value) - 1;
|
|
207
209
|
if (prevIndex < 0)
|
|
208
210
|
prevIndex = 0;
|
|
@@ -212,6 +214,8 @@ var DropdownBase = function (props) {
|
|
|
212
214
|
bodyRef.current.children[0].children[0].children[prevIndex].scrollIntoView({ block: 'start', inline: 'nearest' });
|
|
213
215
|
};
|
|
214
216
|
var selectNextItem = function () {
|
|
217
|
+
if (!props.data)
|
|
218
|
+
return;
|
|
215
219
|
var nextIndex = props.data.indexOf(value) + 1;
|
|
216
220
|
if (props.data.length <= nextIndex)
|
|
217
221
|
return;
|
|
@@ -336,8 +340,8 @@ var DropdownBase = function (props) {
|
|
|
336
340
|
if (child.type && child.type === Column)
|
|
337
341
|
return child;
|
|
338
342
|
});
|
|
339
|
-
var activeIndex = props.data.indexOf(value);
|
|
340
|
-
return props.data.map(function (row, index) {
|
|
343
|
+
var activeIndex = (props.data || []).indexOf(value);
|
|
344
|
+
return (props.data || []).map(function (row, index) {
|
|
341
345
|
return (React.createElement(ListRow, { active: index == activeIndex, key: index + 1, gap: props.gap, onClick: function () { return handleClick(row); } }, columns.map(function (child, index) {
|
|
342
346
|
return (React.createElement(ListCell, { key: index, width: child.props.width, align: child.props.align }, row !== null && child.props.children(row)));
|
|
343
347
|
})));
|