wini-web-components 1.2.1 → 1.2.2
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.
|
@@ -107,16 +107,16 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
107
107
|
_this.onKeyDown = function (ev) {
|
|
108
108
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
109
109
|
console.log(ev.key);
|
|
110
|
-
debugger;
|
|
111
|
-
ev.preventDefault();
|
|
112
110
|
if ((((_a = _this.state.options) === null || _a === void 0 ? void 0 : _a.length) || ((_b = _this.state.search) === null || _b === void 0 ? void 0 : _b.length)) && _this.state.isOpen) {
|
|
113
111
|
switch (ev.key.toLowerCase()) {
|
|
114
112
|
case "enter":
|
|
113
|
+
ev.preventDefault();
|
|
115
114
|
var _selectItem = ((_c = _this.state.search) !== null && _c !== void 0 ? _c : _this.state.options).find(function (e) { return e.id === _this.state.selected; });
|
|
116
115
|
if (_selectItem)
|
|
117
116
|
_this.onSelect(_selectItem);
|
|
118
117
|
break;
|
|
119
118
|
case "arrowup":
|
|
119
|
+
ev.preventDefault();
|
|
120
120
|
if (_this.state.selected) {
|
|
121
121
|
var _index = ((_d = _this.state.search) !== null && _d !== void 0 ? _d : _this.state.options).findIndex(function (e) { return e.id === _this.state.selected; });
|
|
122
122
|
_index = ((_index === 0) ? _this.props.options.length : _index) - 1;
|
|
@@ -124,6 +124,7 @@ var Select1 = /** @class */ (function (_super) {
|
|
|
124
124
|
}
|
|
125
125
|
break;
|
|
126
126
|
case "arrowdown":
|
|
127
|
+
ev.preventDefault();
|
|
127
128
|
if (_this.state.selected) {
|
|
128
129
|
var _index = ((_f = _this.state.search) !== null && _f !== void 0 ? _f : _this.state.options).findIndex(function (e) { return e.id === _this.state.selected; });
|
|
129
130
|
_index = ((_index + 1 === _this.props.options.length) ? -1 : _index) + 1;
|