mirror of
https://github.com/nasa/openmct.git
synced 2025-05-09 03:53:19 +00:00
[Time Conductor] Restore last valid values
Restore last valid values on blur, in a date-time entry field.
This commit is contained in:
parent
976ecce075
commit
1ef09ffbdd
@ -2,7 +2,7 @@
|
|||||||
ng-controller="DateTimeFieldController">
|
ng-controller="DateTimeFieldController">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
ng-model="textValue"
|
ng-model="textValue"
|
||||||
ng-blur="structure.submit()"
|
ng-blur="restoreValue(); structure.submit()"
|
||||||
ng-class="{ error: textInvalid }">
|
ng-class="{ error: textInvalid }">
|
||||||
</input>
|
</input>
|
||||||
<a class="ui-symbol icon icon-calendar"
|
<a class="ui-symbol icon icon-calendar"
|
||||||
|
@ -53,6 +53,7 @@ define(
|
|||||||
formatter.parse($scope.textValue) !== value) {
|
formatter.parse($scope.textValue) !== value) {
|
||||||
$scope.textValue = formatter.format(value);
|
$scope.textValue = formatter.format(value);
|
||||||
$scope.textInvalid = false;
|
$scope.textInvalid = false;
|
||||||
|
$scope.lastValidValue = $scope.textValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ define(
|
|||||||
if (!$scope.textInvalid) {
|
if (!$scope.textInvalid) {
|
||||||
$scope.ngModel[$scope.field] =
|
$scope.ngModel[$scope.field] =
|
||||||
formatter.parse(textValue);
|
formatter.parse(textValue);
|
||||||
|
$scope.lastValidValue = $scope.textValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +71,13 @@ define(
|
|||||||
updateFromModel($scope.ngModel[$scope.field]);
|
updateFromModel($scope.ngModel[$scope.field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreValue() {
|
||||||
|
$scope.textValue = $scope.lastValidValue;
|
||||||
|
updateFromView($scope.textValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.restoreValue = restoreValue;
|
||||||
|
|
||||||
$scope.picker = { active: false };
|
$scope.picker = { active: false };
|
||||||
|
|
||||||
$scope.$watch('structure.format', setFormat);
|
$scope.$watch('structure.format', setFormat);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user