@zohodesk/dot 1.0.0-beta.270 → 1.0.0-beta.271
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/README.md +6 -0
- package/es/Drawer/Drawer.js +19 -6
- package/es/Drawer/props/defaultProps.js +2 -1
- package/es/Drawer/props/propTypes.js +2 -1
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +168 -210
- package/es/list/ListLayout/ListLayout.js +1 -1
- package/es/lookup/Lookup/Lookup.js +19 -6
- package/es/lookup/Lookup/props/defaultProps.js +2 -1
- package/es/lookup/Lookup/props/propTypes.js +2 -1
- package/lib/Drawer/Drawer.js +21 -6
- package/lib/Drawer/props/defaultProps.js +2 -1
- package/lib/Drawer/props/propTypes.js +2 -1
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +258 -301
- package/lib/list/ListLayout/ListLayout.js +1 -1
- package/lib/lookup/Lookup/Lookup.js +21 -6
- package/lib/lookup/Lookup/props/defaultProps.js +2 -1
- package/lib/lookup/Lookup/props/propTypes.js +2 -1
- package/package.json +3 -3
|
@@ -92,13 +92,13 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
92
92
|
_this = _super.call(this, props);
|
|
93
93
|
_this.state = {
|
|
94
94
|
searchValue: '',
|
|
95
|
-
selectedIndex: -1,
|
|
95
|
+
// selectedIndex: -1,
|
|
96
96
|
options: props.options,
|
|
97
97
|
isFetchingOptions: false
|
|
98
98
|
};
|
|
99
99
|
_this._isMounted = false;
|
|
100
|
-
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
101
|
-
|
|
100
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this)); // this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
101
|
+
|
|
102
102
|
_this.onSelect = _this.onSelect.bind(_assertThisInitialized(_this));
|
|
103
103
|
_this.handleTogglePopup = _this.handleTogglePopup.bind(_assertThisInitialized(_this));
|
|
104
104
|
_this.showTogglePopup = _this.showTogglePopup.bind(_assertThisInitialized(_this));
|
|
@@ -106,16 +106,16 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
106
106
|
_this.onSearchAPI = _this.onSearchAPI.bind(_assertThisInitialized(_this));
|
|
107
107
|
_this.onSearchClear = _this.onSearchClear.bind(_assertThisInitialized(_this));
|
|
108
108
|
_this.handleFilterSuggestions = _this.handleFilterSuggestions.bind(_assertThisInitialized(_this));
|
|
109
|
-
_this.scrollContentRef = _this.scrollContentRef.bind(_assertThisInitialized(_this));
|
|
110
|
-
|
|
109
|
+
_this.scrollContentRef = _this.scrollContentRef.bind(_assertThisInitialized(_this)); // this.handleMouseEnter = this.handleMouseEnter.bind(this);
|
|
110
|
+
|
|
111
111
|
_this.searchInputRef = _this.searchInputRef.bind(_assertThisInitialized(_this));
|
|
112
|
-
_this.itemRef = _this.itemRef.bind(_assertThisInitialized(_this));
|
|
113
|
-
|
|
114
|
-
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
|
115
|
-
|
|
112
|
+
_this.itemRef = _this.itemRef.bind(_assertThisInitialized(_this)); // this.inputRef = this.inputRef.bind(this);
|
|
113
|
+
|
|
114
|
+
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this)); // this.getOptionsArray = this.getOptionsArray.bind(this);
|
|
115
|
+
|
|
116
116
|
_this.emptySearchSVG = _this.emptySearchSVG.bind(_assertThisInitialized(_this));
|
|
117
|
-
_this.getAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
|
|
118
|
-
|
|
117
|
+
_this.getAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this)); // this.getSelectedIndex = this.getSelectedIndex.bind(this);
|
|
118
|
+
|
|
119
119
|
_this.handleGetNextOptions = _this.handleGetNextOptions.bind(_assertThisInitialized(_this));
|
|
120
120
|
_this.handleFetchOptions = _this.handleFetchOptions.bind(_assertThisInitialized(_this));
|
|
121
121
|
return _this;
|
|
@@ -137,12 +137,10 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
137
137
|
return /*#__PURE__*/_react["default"].createElement(_EmptySearch["default"], {
|
|
138
138
|
size: "small"
|
|
139
139
|
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.hiddenInput = el;
|
|
145
|
-
}
|
|
140
|
+
} // inputRef(el) {
|
|
141
|
+
// this.hiddenInput = el;
|
|
142
|
+
// }
|
|
143
|
+
|
|
146
144
|
}, {
|
|
147
145
|
key: "itemRef",
|
|
148
146
|
value: function itemRef(ele, index, id) {
|
|
@@ -217,8 +215,6 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
217
215
|
}, {
|
|
218
216
|
key: "componentDidUpdate",
|
|
219
217
|
value: function componentDidUpdate(prevProps) {
|
|
220
|
-
var _this2 = this;
|
|
221
|
-
|
|
222
218
|
var _this$props5 = this.props,
|
|
223
219
|
isPopupOpen = _this$props5.isPopupOpen,
|
|
224
220
|
isPopupReady = _this$props5.isPopupReady,
|
|
@@ -231,26 +227,21 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
231
227
|
selectedIndex = _this$state.selectedIndex,
|
|
232
228
|
searchValue = _this$state.searchValue;
|
|
233
229
|
|
|
234
|
-
if (prevProps.isPopupReady !== isPopupReady) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
var id = option && option[idName] || {};
|
|
249
|
-
var selSuggestion = this["suggestion_".concat(id)];
|
|
230
|
+
if (prevProps.isPopupReady !== isPopupReady) {// setTimeout(() => {
|
|
231
|
+
// isPopupReady
|
|
232
|
+
// ? isSearch
|
|
233
|
+
// ? this.searchInput.focus({ preventScroll: true })
|
|
234
|
+
// : this.hiddenInput.focus({ preventScroll: true })
|
|
235
|
+
// : this.hiddenInput.focus({ preventScroll: true });
|
|
236
|
+
// }, 10);
|
|
237
|
+
} // const optionsArr = this.getOptionsArray();
|
|
238
|
+
// const option = optionsArr[selectedIndex];
|
|
239
|
+
// const id = (option && option[idName]) || {};
|
|
240
|
+
// const selSuggestion = this[`suggestion_${id}`];
|
|
241
|
+
// if (isPopupOpen) {
|
|
242
|
+
// this.optionsContainer && scrollTo(this.optionsContainer, selSuggestion);
|
|
243
|
+
// }
|
|
250
244
|
|
|
251
|
-
if (isPopupOpen) {
|
|
252
|
-
this.optionsContainer && (0, _Common.scrollTo)(this.optionsContainer, selSuggestion);
|
|
253
|
-
}
|
|
254
245
|
|
|
255
246
|
if (!prevProps.isPopupOpen && isPopupOpen && searchValue.length) {
|
|
256
247
|
this.onSearchClear();
|
|
@@ -278,9 +269,8 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
278
269
|
onDropDownOpen && onDropDownOpen();
|
|
279
270
|
} else {
|
|
280
271
|
onDropDownClose && onDropDownClose();
|
|
281
|
-
}
|
|
272
|
+
} // this.getSelectedIndex(optionsArr);
|
|
282
273
|
|
|
283
|
-
this.getSelectedIndex(optionsArr);
|
|
284
274
|
}
|
|
285
275
|
}
|
|
286
276
|
}, {
|
|
@@ -350,143 +340,99 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
350
340
|
}
|
|
351
341
|
|
|
352
342
|
return result;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
343
|
+
} // getOptionsArray() {
|
|
344
|
+
// const { searchValue } = this.state;
|
|
345
|
+
// const { isGroupDropDown, groupOptionsKey } = this.props;
|
|
346
|
+
// const options = searchValue.length ? this.handleFilterSuggestions(searchValue) : this.props.options;
|
|
347
|
+
// let optionsArr = [];
|
|
348
|
+
// if (isGroupDropDown) {
|
|
349
|
+
// for (let i = 0; i < options.length; i++) {
|
|
350
|
+
// const groupOptions = options[i][groupOptionsKey];
|
|
351
|
+
// Array.prototype.push.apply(optionsArr, groupOptions);
|
|
352
|
+
// }
|
|
353
|
+
// } else {
|
|
354
|
+
// optionsArr = options.filter((item) => !item.needDivider);
|
|
355
|
+
// }
|
|
356
|
+
// return optionsArr;
|
|
357
|
+
// }
|
|
358
|
+
// handleKeyDown(e) {
|
|
359
|
+
// const { keyCode } = e;
|
|
360
|
+
// const { selectedIndex, searchValue } = this.state;
|
|
361
|
+
// const optionsArr = this.getOptionsArray();
|
|
362
|
+
// const totalIndex = optionsArr.length;
|
|
363
|
+
// const { togglePopup, onClick, boxPosition, isPopupReady, value, keyName, idName, preventPopupClose, isSearch } =
|
|
364
|
+
// this.props;
|
|
365
|
+
// if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
|
|
366
|
+
// e.preventDefault(); //prevent body scroll
|
|
367
|
+
// }
|
|
368
|
+
// if (isPopupReady) {
|
|
369
|
+
// switch (keyCode) {
|
|
370
|
+
// case 40:
|
|
371
|
+
// if (selectedIndex === totalIndex - 1) {
|
|
372
|
+
// this.setState({ selectedIndex: 0 });
|
|
373
|
+
// } else {
|
|
374
|
+
// if (selectedIndex === totalIndex - 3) {
|
|
375
|
+
// this.handleGetNextOptions();
|
|
376
|
+
// }
|
|
377
|
+
// this.setState({
|
|
378
|
+
// selectedIndex: selectedIndex + 1
|
|
379
|
+
// });
|
|
380
|
+
// }
|
|
381
|
+
// break;
|
|
382
|
+
// case 38:
|
|
383
|
+
// if (selectedIndex === 0) {
|
|
384
|
+
// this.setState({ selectedIndex: totalIndex - 1 });
|
|
385
|
+
// } else {
|
|
386
|
+
// this.setState({
|
|
387
|
+
// selectedIndex: selectedIndex - 1
|
|
388
|
+
// });
|
|
389
|
+
// }
|
|
390
|
+
// break;
|
|
391
|
+
// case 13: {
|
|
392
|
+
// const selectedId = optionsArr[selectedIndex][idName] || '';
|
|
393
|
+
// onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
394
|
+
// if (!preventPopupClose) {
|
|
395
|
+
// togglePopup(e, boxPosition);
|
|
396
|
+
// } else if (isSearch) {
|
|
397
|
+
// this.searchInput.focus({ preventScroll: true });
|
|
398
|
+
// } else {
|
|
399
|
+
// this.hiddenInput.focus({ preventScroll: true });
|
|
400
|
+
// }
|
|
401
|
+
// break;
|
|
402
|
+
// }
|
|
403
|
+
// }
|
|
404
|
+
// } else {
|
|
405
|
+
// if (keyCode === 13 || keyCode === 40) {
|
|
406
|
+
// togglePopup(e, boxPosition);
|
|
407
|
+
// }
|
|
408
|
+
// }
|
|
409
|
+
// }
|
|
410
|
+
// getSelectedIndex(optionsArr) {
|
|
411
|
+
// const { selectedId, idName } = this.props;
|
|
412
|
+
// if (selectedId) {
|
|
413
|
+
// for (let i = 0; i < optionsArr.length; i++) {
|
|
414
|
+
// const indexId = optionsArr[i][idName];
|
|
415
|
+
// if (selectedId === indexId) {
|
|
416
|
+
// this.setState({
|
|
417
|
+
// selectedIndex: i
|
|
418
|
+
// });
|
|
419
|
+
// break;
|
|
420
|
+
// }
|
|
421
|
+
// }
|
|
422
|
+
// } else {
|
|
423
|
+
// this.setState({
|
|
424
|
+
// selectedIndex: -1
|
|
425
|
+
// });
|
|
426
|
+
// }
|
|
427
|
+
// }
|
|
374
428
|
|
|
375
|
-
return optionsArr;
|
|
376
|
-
}
|
|
377
|
-
}, {
|
|
378
|
-
key: "handleKeyDown",
|
|
379
|
-
value: function handleKeyDown(e) {
|
|
380
|
-
var keyCode = e.keyCode;
|
|
381
|
-
var _this$state2 = this.state,
|
|
382
|
-
selectedIndex = _this$state2.selectedIndex,
|
|
383
|
-
searchValue = _this$state2.searchValue;
|
|
384
|
-
var optionsArr = this.getOptionsArray();
|
|
385
|
-
var totalIndex = optionsArr.length;
|
|
386
|
-
var _this$props8 = this.props,
|
|
387
|
-
togglePopup = _this$props8.togglePopup,
|
|
388
|
-
onClick = _this$props8.onClick,
|
|
389
|
-
boxPosition = _this$props8.boxPosition,
|
|
390
|
-
isPopupReady = _this$props8.isPopupReady,
|
|
391
|
-
value = _this$props8.value,
|
|
392
|
-
keyName = _this$props8.keyName,
|
|
393
|
-
idName = _this$props8.idName,
|
|
394
|
-
preventPopupClose = _this$props8.preventPopupClose,
|
|
395
|
-
isSearch = _this$props8.isSearch;
|
|
396
|
-
|
|
397
|
-
if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
|
|
398
|
-
e.preventDefault(); //prevent body scroll
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
if (isPopupReady) {
|
|
402
|
-
switch (keyCode) {
|
|
403
|
-
case 40:
|
|
404
|
-
if (selectedIndex === totalIndex - 1) {
|
|
405
|
-
this.setState({
|
|
406
|
-
selectedIndex: 0
|
|
407
|
-
});
|
|
408
|
-
} else {
|
|
409
|
-
if (selectedIndex === totalIndex - 3) {
|
|
410
|
-
this.handleGetNextOptions();
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
this.setState({
|
|
414
|
-
selectedIndex: selectedIndex + 1
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
break;
|
|
419
|
-
|
|
420
|
-
case 38:
|
|
421
|
-
if (selectedIndex === 0) {
|
|
422
|
-
this.setState({
|
|
423
|
-
selectedIndex: totalIndex - 1
|
|
424
|
-
});
|
|
425
|
-
} else {
|
|
426
|
-
this.setState({
|
|
427
|
-
selectedIndex: selectedIndex - 1
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
break;
|
|
432
|
-
|
|
433
|
-
case 13:
|
|
434
|
-
{
|
|
435
|
-
var selectedId = optionsArr[selectedIndex][idName] || '';
|
|
436
|
-
onClick && onClick(selectedId, optionsArr[selectedIndex]);
|
|
437
|
-
|
|
438
|
-
if (!preventPopupClose) {
|
|
439
|
-
togglePopup(e, boxPosition);
|
|
440
|
-
} else if (isSearch) {
|
|
441
|
-
this.searchInput.focus({
|
|
442
|
-
preventScroll: true
|
|
443
|
-
});
|
|
444
|
-
} else {
|
|
445
|
-
this.hiddenInput.focus({
|
|
446
|
-
preventScroll: true
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
} else {
|
|
454
|
-
if (keyCode === 13 || keyCode === 40) {
|
|
455
|
-
togglePopup(e, boxPosition);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}, {
|
|
460
|
-
key: "getSelectedIndex",
|
|
461
|
-
value: function getSelectedIndex(optionsArr) {
|
|
462
|
-
var _this$props9 = this.props,
|
|
463
|
-
selectedId = _this$props9.selectedId,
|
|
464
|
-
idName = _this$props9.idName;
|
|
465
|
-
|
|
466
|
-
if (selectedId) {
|
|
467
|
-
for (var i = 0; i < optionsArr.length; i++) {
|
|
468
|
-
var indexId = optionsArr[i][idName];
|
|
469
|
-
|
|
470
|
-
if (selectedId === indexId) {
|
|
471
|
-
this.setState({
|
|
472
|
-
selectedIndex: i
|
|
473
|
-
});
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
} else {
|
|
478
|
-
this.setState({
|
|
479
|
-
selectedIndex: -1
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
429
|
}, {
|
|
484
430
|
key: "onSearchAPI",
|
|
485
431
|
value: function onSearchAPI() {
|
|
486
432
|
var searchValue = this.state.searchValue;
|
|
487
|
-
var _this$
|
|
488
|
-
needSearchFetching = _this$
|
|
489
|
-
onSearch = _this$
|
|
433
|
+
var _this$props7 = this.props,
|
|
434
|
+
needSearchFetching = _this$props7.needSearchFetching,
|
|
435
|
+
onSearch = _this$props7.onSearch;
|
|
490
436
|
|
|
491
437
|
if (needSearchFetching && onSearch) {
|
|
492
438
|
onSearch(searchValue);
|
|
@@ -495,37 +441,35 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
495
441
|
}, {
|
|
496
442
|
key: "handleChange",
|
|
497
443
|
value: function handleChange(value, e) {
|
|
498
|
-
var
|
|
444
|
+
var _this2 = this;
|
|
499
445
|
|
|
500
446
|
var filteredOptions = this.handleFilterSuggestions(value);
|
|
501
447
|
this.setState({
|
|
502
448
|
searchValue: value,
|
|
503
|
-
selectedIndex: -1,
|
|
449
|
+
// selectedIndex: -1,
|
|
504
450
|
options: filteredOptions
|
|
505
451
|
}, function () {
|
|
506
|
-
|
|
452
|
+
_this2.onSearchAPI();
|
|
507
453
|
});
|
|
508
454
|
}
|
|
509
455
|
}, {
|
|
510
456
|
key: "onSearchClear",
|
|
511
457
|
value: function onSearchClear() {
|
|
512
|
-
var
|
|
458
|
+
var _this3 = this;
|
|
513
459
|
|
|
514
460
|
var filteredOptions = this.handleFilterSuggestions('');
|
|
515
461
|
this.setState({
|
|
516
462
|
searchValue: '',
|
|
517
463
|
options: filteredOptions
|
|
518
464
|
}, function () {
|
|
519
|
-
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
}, {
|
|
523
|
-
key: "handleMouseEnter",
|
|
524
|
-
value: function handleMouseEnter(id, value, index, e) {
|
|
525
|
-
this.setState({
|
|
526
|
-
selectedIndex: index
|
|
465
|
+
_this3.onSearchAPI();
|
|
527
466
|
});
|
|
528
|
-
}
|
|
467
|
+
} // handleMouseEnter(id, value, index, e) {
|
|
468
|
+
// this.setState({
|
|
469
|
+
// selectedIndex: index
|
|
470
|
+
// });
|
|
471
|
+
// }
|
|
472
|
+
|
|
529
473
|
}, {
|
|
530
474
|
key: "handleScroll",
|
|
531
475
|
value: function handleScroll(e) {
|
|
@@ -536,16 +480,16 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
536
480
|
}, {
|
|
537
481
|
key: "handleGetNextOptions",
|
|
538
482
|
value: function handleGetNextOptions() {
|
|
539
|
-
var _this$
|
|
540
|
-
isNextOptions = _this$
|
|
541
|
-
getNextOptions = _this$
|
|
483
|
+
var _this$props8 = this.props,
|
|
484
|
+
isNextOptions = _this$props8.isNextOptions,
|
|
485
|
+
getNextOptions = _this$props8.getNextOptions;
|
|
542
486
|
var searchValue = this.state.searchValue;
|
|
543
487
|
isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchValue);
|
|
544
488
|
}
|
|
545
489
|
}, {
|
|
546
490
|
key: "handleFetchOptions",
|
|
547
491
|
value: function handleFetchOptions(APICall) {
|
|
548
|
-
var
|
|
492
|
+
var _this4 = this;
|
|
549
493
|
|
|
550
494
|
var searchValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
551
495
|
var _this$state$isFetchin = this.state.isFetchingOptions,
|
|
@@ -559,11 +503,11 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
559
503
|
|
|
560
504
|
try {
|
|
561
505
|
return APICall(searchValue).then(function () {
|
|
562
|
-
_isMounted &&
|
|
506
|
+
_isMounted && _this4.setState({
|
|
563
507
|
isFetchingOptions: false
|
|
564
508
|
});
|
|
565
509
|
}, function () {
|
|
566
|
-
_isMounted &&
|
|
510
|
+
_isMounted && _this4.setState({
|
|
567
511
|
isFetchingOptions: false
|
|
568
512
|
});
|
|
569
513
|
});
|
|
@@ -587,66 +531,66 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
587
531
|
}, {
|
|
588
532
|
key: "render",
|
|
589
533
|
value: function render() {
|
|
590
|
-
var
|
|
534
|
+
var _this5 = this;
|
|
591
535
|
|
|
592
|
-
var _this$
|
|
593
|
-
options = _this$
|
|
594
|
-
selectedIndex = _this$
|
|
595
|
-
var _this$
|
|
596
|
-
value = _this$
|
|
597
|
-
removeClose = _this$
|
|
598
|
-
boxSize = _this$
|
|
599
|
-
keyName = _this$
|
|
600
|
-
idName = _this$
|
|
601
|
-
title = _this$
|
|
602
|
-
isSearch = _this$
|
|
603
|
-
isArrow = _this$
|
|
604
|
-
placeHolderText = _this$
|
|
605
|
-
className = _this$
|
|
606
|
-
right = _this$
|
|
607
|
-
left = _this$
|
|
608
|
-
top = _this$
|
|
609
|
-
bottom = _this$
|
|
610
|
-
isOpen = _this$
|
|
611
|
-
isPopupActive = _this$
|
|
612
|
-
needExternalPopupState = _this$
|
|
613
|
-
isPopupReady = _this$
|
|
614
|
-
position = _this$
|
|
615
|
-
getTargetRef = _this$
|
|
616
|
-
getContainerRef = _this$
|
|
617
|
-
dataId = _this$
|
|
618
|
-
dataSelectorId = _this$
|
|
619
|
-
searchBoxSize = _this$
|
|
620
|
-
searchEmptyHint = _this$
|
|
621
|
-
searchErrorText = _this$
|
|
622
|
-
activeStyle = _this$
|
|
623
|
-
showOnHover = _this$
|
|
624
|
-
isDisabled = _this$
|
|
625
|
-
showIconOnHover = _this$
|
|
626
|
-
isReadOnly = _this$
|
|
627
|
-
hoverStyle = _this$
|
|
628
|
-
isEditable = _this$
|
|
629
|
-
iconName = _this$
|
|
630
|
-
iconSize = _this$
|
|
631
|
-
needTick = _this$
|
|
632
|
-
dataTitle = _this$
|
|
633
|
-
isDataLoaded = _this$
|
|
634
|
-
children = _this$
|
|
635
|
-
needResponsive = _this$
|
|
636
|
-
arrowIconPosition = _this$
|
|
637
|
-
isGroupDropDown = _this$
|
|
638
|
-
groupOptionsKey = _this$
|
|
639
|
-
groupNameKey = _this$
|
|
640
|
-
isToggleStateNeeded = _this$
|
|
641
|
-
selectedId = _this$
|
|
642
|
-
isPadding = _this$
|
|
643
|
-
isNeedEffect = _this$
|
|
644
|
-
hoverType = _this$
|
|
645
|
-
palette = _this$
|
|
646
|
-
getFooter = _this$
|
|
647
|
-
customProps = _this$
|
|
648
|
-
needMultiLineText = _this$
|
|
649
|
-
customClass = _this$
|
|
536
|
+
var _this$state2 = this.state,
|
|
537
|
+
options = _this$state2.options,
|
|
538
|
+
selectedIndex = _this$state2.selectedIndex;
|
|
539
|
+
var _this$props9 = this.props,
|
|
540
|
+
value = _this$props9.value,
|
|
541
|
+
removeClose = _this$props9.removeClose,
|
|
542
|
+
boxSize = _this$props9.boxSize,
|
|
543
|
+
keyName = _this$props9.keyName,
|
|
544
|
+
idName = _this$props9.idName,
|
|
545
|
+
title = _this$props9.title,
|
|
546
|
+
isSearch = _this$props9.isSearch,
|
|
547
|
+
isArrow = _this$props9.isArrow,
|
|
548
|
+
placeHolderText = _this$props9.placeHolderText,
|
|
549
|
+
className = _this$props9.className,
|
|
550
|
+
right = _this$props9.right,
|
|
551
|
+
left = _this$props9.left,
|
|
552
|
+
top = _this$props9.top,
|
|
553
|
+
bottom = _this$props9.bottom,
|
|
554
|
+
isOpen = _this$props9.isPopupOpen,
|
|
555
|
+
isPopupActive = _this$props9.isPopupActive,
|
|
556
|
+
needExternalPopupState = _this$props9.needExternalPopupState,
|
|
557
|
+
isPopupReady = _this$props9.isPopupReady,
|
|
558
|
+
position = _this$props9.position,
|
|
559
|
+
getTargetRef = _this$props9.getTargetRef,
|
|
560
|
+
getContainerRef = _this$props9.getContainerRef,
|
|
561
|
+
dataId = _this$props9.dataId,
|
|
562
|
+
dataSelectorId = _this$props9.dataSelectorId,
|
|
563
|
+
searchBoxSize = _this$props9.searchBoxSize,
|
|
564
|
+
searchEmptyHint = _this$props9.searchEmptyHint,
|
|
565
|
+
searchErrorText = _this$props9.searchErrorText,
|
|
566
|
+
activeStyle = _this$props9.activeStyle,
|
|
567
|
+
showOnHover = _this$props9.showOnHover,
|
|
568
|
+
isDisabled = _this$props9.isDisabled,
|
|
569
|
+
showIconOnHover = _this$props9.showIconOnHover,
|
|
570
|
+
isReadOnly = _this$props9.isReadOnly,
|
|
571
|
+
hoverStyle = _this$props9.hoverStyle,
|
|
572
|
+
isEditable = _this$props9.isEditable,
|
|
573
|
+
iconName = _this$props9.iconName,
|
|
574
|
+
iconSize = _this$props9.iconSize,
|
|
575
|
+
needTick = _this$props9.needTick,
|
|
576
|
+
dataTitle = _this$props9.dataTitle,
|
|
577
|
+
isDataLoaded = _this$props9.isDataLoaded,
|
|
578
|
+
children = _this$props9.children,
|
|
579
|
+
needResponsive = _this$props9.needResponsive,
|
|
580
|
+
arrowIconPosition = _this$props9.arrowIconPosition,
|
|
581
|
+
isGroupDropDown = _this$props9.isGroupDropDown,
|
|
582
|
+
groupOptionsKey = _this$props9.groupOptionsKey,
|
|
583
|
+
groupNameKey = _this$props9.groupNameKey,
|
|
584
|
+
isToggleStateNeeded = _this$props9.isToggleStateNeeded,
|
|
585
|
+
selectedId = _this$props9.selectedId,
|
|
586
|
+
isPadding = _this$props9.isPadding,
|
|
587
|
+
isNeedEffect = _this$props9.isNeedEffect,
|
|
588
|
+
hoverType = _this$props9.hoverType,
|
|
589
|
+
palette = _this$props9.palette,
|
|
590
|
+
getFooter = _this$props9.getFooter,
|
|
591
|
+
customProps = _this$props9.customProps,
|
|
592
|
+
needMultiLineText = _this$props9.needMultiLineText,
|
|
593
|
+
customClass = _this$props9.customClass;
|
|
650
594
|
var _customProps$ToggleDr = customProps.ToggleDropDownProps,
|
|
651
595
|
ToggleDropDownProps = _customProps$ToggleDr === void 0 ? {} : _customProps$ToggleDr,
|
|
652
596
|
_customProps$DropBoxP = customProps.DropBoxProps,
|
|
@@ -664,13 +608,13 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
664
608
|
var isPopupOpen = needExternalPopupState ? isPopupActive && isOpen : isOpen;
|
|
665
609
|
var Component = isToggleStateNeeded ? children.type : null,
|
|
666
610
|
componentProps = isToggleStateNeeded ? children.props : null;
|
|
667
|
-
var _this$
|
|
668
|
-
searchValue = _this$
|
|
669
|
-
isFetchingOptions = _this$
|
|
611
|
+
var _this$state3 = this.state,
|
|
612
|
+
searchValue = _this$state3.searchValue,
|
|
613
|
+
isFetchingOptions = _this$state3.isFetchingOptions;
|
|
670
614
|
var commonClass = "".concat(className ? className : '', " ").concat(isPopupReady ? activeStyle ? activeStyle : '' : '', " ").concat(isDisabled ? (0, _CssProvider["default"])('isDisable') : isReadOnly || !isEditable ? _ToggleDropDownModule["default"].cursorDefault : !showOnHover ? "".concat(_ToggleDropDownModule["default"].cursor, " ").concat(hoverStyle ? hoverStyle : '') : "".concat(hoverStyle ? hoverStyle : '', " ").concat(_ToggleDropDownModule["default"].cursorDefault));
|
|
671
615
|
var listIndex = -1;
|
|
672
|
-
var ariaTitleId = this.getAriaId();
|
|
673
|
-
|
|
616
|
+
var ariaTitleId = this.getAriaId(); // const allyOptionsArr = this.getOptionsArray();
|
|
617
|
+
|
|
674
618
|
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
675
619
|
className: _ToggleDropDownModule["default"].wrapper,
|
|
676
620
|
onMouseEnter: showOnHover && !isDisabled && !isReadOnly && isEditable ? this.showTogglePopup : undefined,
|
|
@@ -683,15 +627,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
683
627
|
align: "vertical",
|
|
684
628
|
isCover: false,
|
|
685
629
|
dataId: dataId
|
|
686
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
687
|
-
className: _ToggleDropDownModule["default"].hiddenInput
|
|
688
|
-
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
689
|
-
type: "text",
|
|
690
|
-
ref: this.inputRef,
|
|
691
|
-
onKeyDown: this.handleKeyDown,
|
|
692
|
-
tabIndex: "-1",
|
|
693
|
-
className: _ToggleDropDownModule["default"].hiddenInputElement
|
|
694
|
-
})), children ? isToggleStateNeeded ? /*#__PURE__*/_react["default"].createElement(Component, _extends({}, componentProps, {
|
|
630
|
+
}, children ? isToggleStateNeeded ? /*#__PURE__*/_react["default"].createElement(Component, _extends({}, componentProps, {
|
|
695
631
|
isActive: isPopupOpen
|
|
696
632
|
})) : children : /*#__PURE__*/_react["default"].createElement(_RippleEffect["default"], {
|
|
697
633
|
hoverType: hoverType,
|
|
@@ -753,21 +689,37 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
753
689
|
ariaLabelledby: !isSearch ? ariaTitleId : undefined
|
|
754
690
|
},
|
|
755
691
|
palette: palette,
|
|
756
|
-
isResponsivePadding: true
|
|
757
|
-
|
|
692
|
+
isResponsivePadding: true,
|
|
693
|
+
needFocusScope: true,
|
|
694
|
+
customProps: {
|
|
695
|
+
focusScopeProps: {
|
|
696
|
+
loadNextOptions: _this5.handleGetNextOptions,
|
|
697
|
+
searchValue: searchValue,
|
|
698
|
+
isFetchingOptions: isFetchingOptions
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}, DropBoxProps, {
|
|
702
|
+
onClose: _this5.handleTogglePopup
|
|
703
|
+
}), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isSearch ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
758
704
|
className: _ToggleDropDownModule["default"].search
|
|
759
705
|
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
|
|
760
706
|
placeHolder: placeHolderText,
|
|
761
|
-
onChange:
|
|
707
|
+
onChange: _this5.handleChange,
|
|
762
708
|
value: searchValue,
|
|
763
|
-
onClear:
|
|
764
|
-
size: searchBoxSize
|
|
765
|
-
|
|
766
|
-
|
|
709
|
+
onClear: _this5.onSearchClear,
|
|
710
|
+
size: searchBoxSize // inputRef={this.searchInputRef}
|
|
711
|
+
,
|
|
712
|
+
customProps: {
|
|
713
|
+
TextBoxProps: {
|
|
714
|
+
'data-a11y-autofocus': true
|
|
715
|
+
}
|
|
716
|
+
} //search
|
|
717
|
+
// onKeyDown={this.handleKeyDown}
|
|
718
|
+
,
|
|
767
719
|
a11y: {
|
|
768
720
|
role: 'combobox',
|
|
769
721
|
ariaOwns: ariaTitleId,
|
|
770
|
-
ariaActivedescendant: allyOptionsArr[selectedIndex] && allyOptionsArr[selectedIndex][keyName],
|
|
722
|
+
// ariaActivedescendant: allyOptionsArr[selectedIndex] && allyOptionsArr[selectedIndex][keyName],
|
|
771
723
|
ariaAutocomplete: 'list',
|
|
772
724
|
ariaHaspopup: true,
|
|
773
725
|
ariaExpanded: true
|
|
@@ -790,10 +742,11 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
790
742
|
preventParentScroll: "vertical",
|
|
791
743
|
dataId: "".concat(dataId, "_list"),
|
|
792
744
|
className: "".concat(tabletMode ? _ToggleDropDownModule["default"].responsivemaxHgt : _ToggleDropDownModule["default"].maxHgt, " ").concat(customListBox),
|
|
793
|
-
eleRef:
|
|
794
|
-
onScroll:
|
|
795
|
-
role: isSearch ? 'listbox' :
|
|
796
|
-
"aria-labelledby": isSearch ? ariaTitleId : undefined
|
|
745
|
+
eleRef: _this5.scrollContentRef,
|
|
746
|
+
onScroll: _this5.handleScroll,
|
|
747
|
+
role: isSearch ? 'listbox' : 'menu',
|
|
748
|
+
"aria-labelledby": isSearch ? ariaTitleId : undefined,
|
|
749
|
+
"data-scroll": "true"
|
|
797
750
|
}, isDataLoaded ? options && options.length != 0 ? isGroupDropDown ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, options.map(function (group) {
|
|
798
751
|
var groupName = group[groupNameKey];
|
|
799
752
|
var groupOptions = group[groupOptionsKey];
|
|
@@ -826,21 +779,22 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
826
779
|
value: item[keyName],
|
|
827
780
|
id: item[idName],
|
|
828
781
|
active: selectedId === item[idName],
|
|
829
|
-
onClick:
|
|
830
|
-
index: listIndex
|
|
831
|
-
|
|
782
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
783
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
784
|
+
,
|
|
832
785
|
disableTitle: disableTitle,
|
|
833
786
|
isDisabled: isDisabled,
|
|
834
787
|
iconName: iconName,
|
|
835
788
|
iconClass: iconClass,
|
|
836
789
|
iconSize: iconSize,
|
|
837
790
|
needTick: needTick,
|
|
838
|
-
needBorder: false
|
|
839
|
-
|
|
840
|
-
getRef:
|
|
791
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
792
|
+
,
|
|
793
|
+
getRef: _this5.itemRef,
|
|
841
794
|
title: title ? title : item[keyName],
|
|
842
795
|
palette: palette,
|
|
843
796
|
needMultiLineText: needMultiLineText,
|
|
797
|
+
autoHover: true,
|
|
844
798
|
a11y: {
|
|
845
799
|
role: isSearch ? 'option' : 'menuitem',
|
|
846
800
|
ariaSelected: selectedId === item[idName],
|
|
@@ -852,18 +806,19 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
852
806
|
value: item[keyName],
|
|
853
807
|
id: item[idName],
|
|
854
808
|
active: selectedId === item[idName],
|
|
855
|
-
onClick:
|
|
809
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
856
810
|
isDisabled: isDisabled,
|
|
857
811
|
disableTitle: disableTitle,
|
|
858
|
-
index: listIndex
|
|
859
|
-
|
|
812
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
813
|
+
,
|
|
860
814
|
needTick: needTick,
|
|
861
|
-
needBorder: false
|
|
862
|
-
|
|
863
|
-
getRef:
|
|
815
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
816
|
+
,
|
|
817
|
+
getRef: _this5.itemRef,
|
|
864
818
|
title: title ? title : item[keyName],
|
|
865
819
|
palette: palette,
|
|
866
820
|
needMultiLineText: needMultiLineText,
|
|
821
|
+
autoHover: true,
|
|
867
822
|
a11y: {
|
|
868
823
|
role: isSearch ? 'option' : 'menuitem',
|
|
869
824
|
ariaSelected: selectedId === item[idName],
|
|
@@ -898,22 +853,23 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
898
853
|
value: item[keyName],
|
|
899
854
|
id: item[idName],
|
|
900
855
|
active: selectedId === item[idName],
|
|
901
|
-
onClick:
|
|
856
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
902
857
|
index: listIndex,
|
|
903
858
|
disableTitle: disableTitle,
|
|
904
|
-
isDisabled: isDisabled
|
|
905
|
-
|
|
859
|
+
isDisabled: isDisabled // highlight={selectedIndex === listIndex}
|
|
860
|
+
,
|
|
906
861
|
iconName: iconName,
|
|
907
862
|
iconClass: iconClass,
|
|
908
863
|
iconSize: iconSize,
|
|
909
864
|
needTick: needTick,
|
|
910
|
-
needBorder: false
|
|
911
|
-
|
|
912
|
-
getRef:
|
|
865
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
866
|
+
,
|
|
867
|
+
getRef: _this5.itemRef,
|
|
913
868
|
title: title ? title : item[keyName],
|
|
914
869
|
key: listIndex,
|
|
915
870
|
palette: palette,
|
|
916
871
|
needMultiLineText: needMultiLineText,
|
|
872
|
+
autoHover: true,
|
|
917
873
|
a11y: {
|
|
918
874
|
role: isSearch ? 'option' : 'menuitem',
|
|
919
875
|
ariaSelected: selectedId === item[idName],
|
|
@@ -927,16 +883,17 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
927
883
|
disableTitle: disableTitle,
|
|
928
884
|
isDisabled: isDisabled,
|
|
929
885
|
active: selectedId === item[idName],
|
|
930
|
-
onClick:
|
|
931
|
-
index: listIndex
|
|
932
|
-
|
|
886
|
+
onClick: _this5.onSelect.bind(_this5, item),
|
|
887
|
+
index: listIndex // highlight={selectedIndex === listIndex}
|
|
888
|
+
,
|
|
933
889
|
needTick: needTick,
|
|
934
|
-
needBorder: false
|
|
935
|
-
|
|
936
|
-
getRef:
|
|
890
|
+
needBorder: false // onMouseEnter={this.handleMouseEnter}
|
|
891
|
+
,
|
|
892
|
+
getRef: _this5.itemRef,
|
|
937
893
|
title: title ? title : item[keyName],
|
|
938
894
|
palette: palette,
|
|
939
895
|
needMultiLineText: needMultiLineText,
|
|
896
|
+
autoHover: true,
|
|
940
897
|
a11y: {
|
|
941
898
|
role: isSearch ? 'option' : 'menuitem',
|
|
942
899
|
ariaSelected: selectedId === item[idName],
|
|
@@ -951,7 +908,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
|
|
|
951
908
|
description: searchEmptyHint,
|
|
952
909
|
title: searchErrorText || 'No results',
|
|
953
910
|
size: "small",
|
|
954
|
-
getEmptyState:
|
|
911
|
+
getEmptyState: _this5.emptySearchSVG
|
|
955
912
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
956
913
|
className: _ToggleDropDownModule["default"].loader
|
|
957
914
|
}, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, getFooter()) : null));
|