mirror of
https://github.com/nasa/openmct.git
synced 2025-03-19 18:45:31 +00:00
added enter, esc listeners to time popups
This commit is contained in:
parent
8d434e30d4
commit
2cf5e738c1
@ -182,13 +182,22 @@ export default {
|
||||
this.handleNewBounds = _.throttle(this.handleNewBounds, 300);
|
||||
},
|
||||
mounted() {
|
||||
document.addEventListener('keydown', this.handleKeyDown);
|
||||
this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.getTimeSystem())));
|
||||
this.setViewFromBounds(this.bounds);
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.clearAllValidation();
|
||||
document.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
methods: {
|
||||
handleKeyDown({ key }) {
|
||||
if (key === 'Enter' && !this.hasInputValidityError) {
|
||||
this.handleFormSubmission(true);
|
||||
} else if (key === 'Escape') {
|
||||
this.dismiss();
|
||||
}
|
||||
},
|
||||
handleNewBounds(bounds) {
|
||||
this.setBounds(bounds);
|
||||
this.setViewFromBounds(bounds);
|
||||
@ -322,8 +331,11 @@ export default {
|
||||
},
|
||||
hide($event) {
|
||||
if ($event.target.className.indexOf('c-button icon-x') > -1) {
|
||||
this.$emit('dismiss');
|
||||
this.dismiss();
|
||||
}
|
||||
},
|
||||
dismiss() {
|
||||
this.$emit('dismiss');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -172,11 +172,20 @@ export default {
|
||||
mounted() {
|
||||
this.setOffsets();
|
||||
document.addEventListener('click', this.hide);
|
||||
document.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
beforeUnmount() {
|
||||
document.removeEventListener('click', this.hide);
|
||||
document.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
methods: {
|
||||
handleKeyDown({ key }) {
|
||||
if (key === 'Enter' && !this.isDisabled) {
|
||||
this.submit();
|
||||
} else if (key === 'Escape') {
|
||||
this.dismiss();
|
||||
}
|
||||
},
|
||||
format(ref) {
|
||||
const curVal = this[ref];
|
||||
this[ref] = curVal.toString().padStart(2, '0');
|
||||
@ -218,13 +227,16 @@ export default {
|
||||
seconds: this.endInputSecs
|
||||
}
|
||||
});
|
||||
this.$emit('dismiss');
|
||||
this.dismiss();
|
||||
},
|
||||
hide($event) {
|
||||
if ($event.target.className.indexOf('c-button icon-x') > -1) {
|
||||
this.$emit('dismiss');
|
||||
this.dismiss();
|
||||
}
|
||||
},
|
||||
dismiss() {
|
||||
this.$emit('dismiss');
|
||||
},
|
||||
increment($ev, ref) {
|
||||
$ev.preventDefault();
|
||||
const step = ref === 'startInputHrs' || ref === 'endInputHrs' ? 1 : 5;
|
||||
|
Loading…
x
Reference in New Issue
Block a user