mirror of
https://github.com/grafana/grafana.git
synced 2026-07-29 15:59:50 -05:00
converted ng_model_on_blur.js to ts, deletedkeyboard_manager.js (#9676)
This commit is contained in:
committed by
Torkel Ödegaard
parent
624b75b58c
commit
c8f7361e3f
+20
-14
@@ -1,11 +1,8 @@
|
||||
define([
|
||||
'../core_module',
|
||||
'app/core/utils/rangeutil',
|
||||
],
|
||||
function (coreModule, rangeUtil) {
|
||||
'use strict';
|
||||
import coreModule from '../core_module';
|
||||
import rangeUtil from 'app/core/utils/rangeutil';
|
||||
|
||||
coreModule.default.directive('ngModelOnblur', function() {
|
||||
export class NgModelOnBlur {
|
||||
constructor() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
priority: 1,
|
||||
@@ -23,22 +20,27 @@ function (coreModule, rangeUtil) {
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.default.directive('emptyToNull', function () {
|
||||
|
||||
export class EmptyToNull {
|
||||
constructor() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, elm, attrs, ctrl) {
|
||||
ctrl.$parsers.push(function (viewValue) {
|
||||
if(viewValue === "") { return null; }
|
||||
if (viewValue === "") { return null; }
|
||||
return viewValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.default.directive('validTimeSpan', function() {
|
||||
export class ValidTimeSpan {
|
||||
constructor() {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function(scope, elm, attrs, ctrl) {
|
||||
@@ -54,5 +56,9 @@ function (coreModule, rangeUtil) {
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.directive('ngModelOnblur', NgModelOnBlur);
|
||||
coreModule.directive('emptyToNull', EmptyToNull);
|
||||
coreModule.directive('validTimeSpan', ValidTimeSpan);
|
||||
Reference in New Issue
Block a user