mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
[Date Input] Addressed issues with date selector. Fixes #1000
This commit is contained in:
parent
b0f06a2195
commit
29dd51439d
@ -29,10 +29,12 @@
|
|||||||
!structure.validate(ngModel[field])),
|
!structure.validate(ngModel[field])),
|
||||||
'picker-icon': structure.format === 'utc' || !structure.format
|
'picker-icon': structure.format === 'utc' || !structure.format
|
||||||
}">
|
}">
|
||||||
</input><a class="ui-symbol icon icon-calendar"
|
</input>
|
||||||
ng-if="structure.format === 'utc' || !structure.format"
|
<a class="ui-symbol icon icon-calendar"
|
||||||
ng-click="picker.active = !picker.active">
|
ng-if="!picker.active && (structure.format === 'utc' || !structure.format)"
|
||||||
</a>
|
ng-click="picker.active = !picker.active"></a>
|
||||||
|
<!-- If picker active show icon with no onclick to prevent double registration of clicks -->
|
||||||
|
<a class="ui-symbol icon icon-calendar" ng-if="picker.active"></a>
|
||||||
<mct-popup ng-if="picker.active">
|
<mct-popup ng-if="picker.active">
|
||||||
<div mct-click-elsewhere="picker.active = false">
|
<div mct-click-elsewhere="picker.active = false">
|
||||||
<mct-control key="'datetime-picker'"
|
<mct-control key="'datetime-picker'"
|
||||||
|
@ -72,6 +72,17 @@ define(
|
|||||||
if ($scope.ngBlur) {
|
if ($scope.ngBlur) {
|
||||||
$scope.ngBlur();
|
$scope.ngBlur();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If picker is active, dismiss it when valid value has been selected
|
||||||
|
// This 'if' is to avoid unnecessary validation if picker is not active
|
||||||
|
if ($scope.picker.active) {
|
||||||
|
if ($scope.structure.validate && $scope.structure.validate($scope.ngModel[$scope.field])) {
|
||||||
|
$scope.picker.active = false;
|
||||||
|
} else if (!$scope.structure.validate) {
|
||||||
|
//If picker visible, but no validation function, hide picker
|
||||||
|
$scope.picker.active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +104,6 @@ define(
|
|||||||
$scope.$watch('ngModel[field]', updateFromModel);
|
$scope.$watch('ngModel[field]', updateFromModel);
|
||||||
$scope.$watch('pickerModel.value', updateFromPicker);
|
$scope.$watch('pickerModel.value', updateFromPicker);
|
||||||
$scope.$watch('textValue', updateFromView);
|
$scope.$watch('textValue', updateFromView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DateTimeFieldController;
|
return DateTimeFieldController;
|
||||||
|
@ -51,7 +51,9 @@ define(
|
|||||||
yMax = yMin + rect.height;
|
yMax = yMin + rect.height;
|
||||||
|
|
||||||
if (x < xMin || x > xMax || y < yMin || y > yMax) {
|
if (x < xMin || x > xMax || y < yMin || y > yMax) {
|
||||||
scope.$eval(attrs.mctClickElsewhere);
|
scope.$apply(function () {
|
||||||
|
scope.$eval(attrs.mctClickElsewhere);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("triggers an evaluation of its related Angular expression", function () {
|
it("triggers an evaluation of its related Angular expression", function () {
|
||||||
|
expect(mockScope.$apply).toHaveBeenCalled();
|
||||||
|
mockScope.$apply.mostRecentCall.args[0]();
|
||||||
expect(mockScope.$eval)
|
expect(mockScope.$eval)
|
||||||
.toHaveBeenCalledWith(testAttrs.mctClickElsewhere);
|
.toHaveBeenCalledWith(testAttrs.mctClickElsewhere);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user