Repository URL to install this package:
|
Version:
3.12.20 ▾
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var SuggestionMode = /*#__PURE__*/function () {
function SuggestionMode(manager) {
_classCallCheck(this, SuggestionMode);
_defineProperty(this, "id", null);
_defineProperty(this, "char", null);
_defineProperty(this, "manager", null);
this.manager = manager;
}
_createClass(SuggestionMode, [{
key: "searchQuery",
get: function get() {
var _this$manager$searchI;
return ((_this$manager$searchI = this.manager.searchInputRef) === null || _this$manager$searchI === void 0 ? void 0 : _this$manager$searchI.value) || '';
}
}, {
key: "modeSearchQuery",
get: function get() {
var _this$searchQuery$mat;
return (_this$searchQuery$mat = this.searchQuery.match(new RegExp(".*".concat(this["char"], "([^").concat(this["char"], "]*)")))) === null || _this$searchQuery$mat === void 0 ? void 0 : _this$searchQuery$mat[1];
}
}, {
key: "searchQueryLastChar",
get: function get() {
return this.searchQuery.slice(-1);
}
}, {
key: "onEnterPressed",
value: function onEnterPressed(event) {}
}, {
key: "onEscapePressed",
value: function onEscapePressed(event) {
this.reset();
}
}, {
key: "reset",
value: function reset() {
var newValue = this.searchQuery.replace(new RegExp("".concat(this["char"], "[^").concat(this["char"], "]*")), '');
this.manager.changeSearchInputValue(newValue);
this.manager.setMode(null);
this.manager.setActiveAttribute(null);
this.manager.activateAttribute(null);
}
}, {
key: "shouldPreventDefaultKeyDown",
value: function shouldPreventDefaultKeyDown(event) {
return false;
}
}, {
key: "onKeyDown",
value: function onKeyDown(event) {}
}, {
key: "getItems",
value: function getItems() {
return [];
}
}, {
key: "getEmptyItemsPlaceholder",
value: function getEmptyItemsPlaceholder(items) {
return '';
}
}]);
return SuggestionMode;
}();
export default SuggestionMode;