Repository URL to install this package:
|
Version:
0.0.13 ▾
|
import * as tslib_1 from "tslib";
import { observable, action } from 'xmobx/mobx';
class SearchState {
constructor() {
this.value = '';
this.isActive = false;
this.isClosing = false;
this.isVisible = true;
}
show(event) {
this.isVisible = true;
}
hide(event) {
this.isVisible = false;
}
// toString() {
// return this.value
// }
onFocusToggle(event) {
console.debug('[SearchInput] this: onFocusToggle');
this.isActive = !this.isActive;
}
setValue(value) {
console.debug('[SearchInput] this: setValue ', value);
this.value = value;
}
onKeyDown(event) {
// event.persist()
// console.debug('updating', event)
console.debug('[SearchInput] this: onKeyDown');
this.value = event.target.value;
}
}
tslib_1.__decorate([
observable
], SearchState.prototype, "value", void 0);
tslib_1.__decorate([
observable
], SearchState.prototype, "isActive", void 0);
tslib_1.__decorate([
observable
], SearchState.prototype, "isClosing", void 0);
tslib_1.__decorate([
observable
], SearchState.prototype, "isVisible", void 0);
tslib_1.__decorate([
action
], SearchState.prototype, "show", null);
tslib_1.__decorate([
action
], SearchState.prototype, "hide", null);
tslib_1.__decorate([
action
], SearchState.prototype, "onFocusToggle", null);
tslib_1.__decorate([
action
], SearchState.prototype, "setValue", null);
tslib_1.__decorate([
action
], SearchState.prototype, "onKeyDown", null);
function toSearchState() {
const state = new SearchState();
return state;
}
export { SearchState, toSearchState };
//# sourceMappingURL=container.js.map