V8: Angular Divorce: isUndefined (#7856)

* Bye bye angular.isUndefinied & hello Utilities.isUndefined

* Add utilities.js to lazyload initialise scripts

* Remove utilities.js as copied over client folder
This commit is contained in:
Warren Buckley
2020-12-10 00:21:34 +00:00
committed by GitHub
parent 7a71bc5410
commit e38e5d6577
10 changed files with 22 additions and 13 deletions

View File

@@ -126,7 +126,7 @@
// Load in ace library
assetsService.load(['lib/ace-builds/src-min-noconflict/ace.js', 'lib/ace-builds/src-min-noconflict/ext-language_tools.js'], scope).then(function () {
if (angular.isUndefined(window.ace)) {
if (Utilities.isUndefined(window.ace)) {
throw new Error('ui-ace need ace to work... (o rly?)');
} else {
// init editor

View File

@@ -30,15 +30,15 @@ Use this directive to generate color swatches to pick from.
function link(scope, el, attr, ctrl) {
// Set default to true if not defined
if (angular.isUndefined(scope.useColorClass)) {
if (Utilities.isUndefined(scope.useColorClass)) {
scope.useColorClass = false;
}
// Set default to "btn" if not defined
if (angular.isUndefined(scope.colorClassNamePrefix)) {
if (Utilities.isUndefined(scope.colorClassNamePrefix)) {
scope.colorClassNamePrefix = "btn";
}
scope.setColor = function (color, $index, $event) {
if (scope.onSelect) {
// did the value change?

View File

@@ -13,7 +13,7 @@
*/
angular.module("umbraco.filters").filter('umbCmsJoinArray', function () {
return function join(array, separator, prop) {
return (!angular.isUndefined(prop) ? array.map(function (item) {
return (!Utilities.isUndefined(prop) ? array.map(function (item) {
return item[prop];
}) : array).join(separator || '');
};

View File

@@ -17,7 +17,7 @@
return collection;
}
if (angular.isUndefined(property)) {
if (Utilities.isUndefined(property)) {
return collection;
}

View File

@@ -1,6 +1,6 @@
LazyLoad.js([
'lib/jquery/jquery.min.js',
'lib/angular/angular.js',
'lib/angular-cookies/angular-cookies.js',
'lib/angular-touch/angular-touch.js',
@@ -8,10 +8,14 @@ LazyLoad.js([
'lib/angular-messages/angular-messages.js',
'lib/angular-aria/angular-aria.min.js',
'lib/underscore/underscore-min.js',
'lib/angular-ui-sortable/sortable.js',
'lib/angular-ui-sortable/sortable.js',
'js/utilities.js',
'js/installer.app.js',
'js/umbraco.directives.js',
'js/umbraco.installer.js'
], function () {
jQuery(document).ready(function () {
angular.bootstrap(document, ['umbraco']);

View File

@@ -10,7 +10,7 @@ angular.module("umbraco.install").controller("Umbraco.Installer.DataBaseControll
{ name: 'Custom connection string', id: -1 }
];
if (angular.isUndefined(installerService.status.current.model.dbType) || installerService.status.current.model.dbType === null) {
if (Utilities.isUndefined(installerService.status.current.model.dbType) || installerService.status.current.model.dbType === null) {
installerService.status.current.model.dbType = 0;
}

View File

@@ -147,7 +147,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
});
}
if (!angular.isUndefined($scope.model.target.isMedia)) {
if (!Utilities.isUndefined($scope.model.target.isMedia)) {
delete $scope.model.target.isMedia;
}
}

View File

@@ -1377,13 +1377,13 @@ function MockHttpExpectation(method, url, data, headers) {
};
this.matchHeaders = function (h) {
if (angular.isUndefined(headers)) return true;
if (Utilities.isUndefined(headers)) return true;
if (angular.isFunction(headers)) return headers(h);
return angular.equals(headers, h);
};
this.matchData = function (d) {
if (angular.isUndefined(data)) return true;
if (Utilities.isUndefined(data)) return true;
if (data && angular.isFunction(data.test)) return data.test(d);
if (data && !Utilities.isString(data)) return angular.toJson(data) == d;
return data == d;

View File

@@ -34,6 +34,8 @@
'lib/umbraco/NamespaceManager.js',
'lib/umbraco/LegacySpeechBubble.js',
'js/utilities.js',
'js/app.js',
'js/umbraco.resources.js',
@@ -43,5 +45,5 @@
'js/umbraco.interceptors.js',
'js/umbraco.controllers.js',
'js/routes.js',
'js/init.js'
'js/init.js'
]

View File

@@ -3,6 +3,9 @@
'../lib/angular/angular.js',
'../lib/underscore/underscore-min.js',
'../lib/umbraco/Extensions.js',
'../js/utilities.js',
'../js/app.js',
'../js/umbraco.resources.js',
'../js/umbraco.services.js',