diff --git a/src/Umbraco.Web.UI.Client/.babelrc b/src/Umbraco.Web.UI.Client/.babelrc index ae044dabd8..748cd6a810 100644 --- a/src/Umbraco.Web.UI.Client/.babelrc +++ b/src/Umbraco.Web.UI.Client/.babelrc @@ -6,5 +6,13 @@ "targets": "last 2 version, not dead, > 0.5%, not ie 11" } ] + ], + "plugins": [ + [ + "@babel/plugin-proposal-object-rest-spread", + { + "useBuiltIns": true + } + ] ] } diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 6514f2f217..045f788929 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -53,6 +53,7 @@ "devDependencies": { "@babel/core": "7.6.4", "@babel/preset-env": "7.6.3", + "@babel/plugin-proposal-object-rest-spread": "7.13.8", "autoprefixer": "9.6.5", "caniuse-lite": "^1.0.30001037", "cssnano": "4.1.10", diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index e2b2e2c3df..7b690e5863 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -75,7 +75,7 @@ angular.module("umbraco.directives") maxImageSize: editorConfig.maxImageSize }; - angular.extend(baseLineConfigObj, standardConfig); + Utilities.extend(baseLineConfigObj, standardConfig); baseLineConfigObj.setup = function (editor) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js index 5e1f2489e6..ef463e6d95 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js @@ -146,8 +146,7 @@ * umbAceEditorConfig merged with user options via json in attribute or data binding * @type object */ - var opts = angular.extend({}, options, scope.umbAceEditor); - + var opts = Utilities.extend({}, options, scope.umbAceEditor); //load ace libraries here... @@ -273,7 +272,7 @@ return; } - opts = angular.extend({}, options, scope.umbAceEditor); + opts = Utilities.extend({}, options, scope.umbAceEditor); opts.callbacks = [opts.onLoad]; if (opts.onLoad !== options.onLoad) { diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js index 368eab2339..b6e5183b30 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js @@ -776,7 +776,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js index 838e8f1b80..0b060da34b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js @@ -439,7 +439,7 @@ function entityResource($q, $http, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct @@ -512,7 +512,7 @@ function entityResource($q, $http, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js index bcdaddd22f..b1931af541 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js @@ -71,7 +71,7 @@ function logResource($q, $http, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; @@ -140,7 +140,7 @@ function logResource($q, $http, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/logviewer.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/logviewer.resource.js index d2d008640d..46ef8d2919 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/logviewer.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/logviewer.resource.js @@ -58,7 +58,7 @@ function logViewerResource($q, $http, umbRequestHelper) { } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js index 06eb2ed4d2..87ba054675 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js @@ -333,7 +333,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct @@ -563,7 +563,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js index c45e173a98..05e746a69b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js @@ -40,7 +40,7 @@ function memberResource($q, $http, umbDataFormatter, umbRequestHelper) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/relationtype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/relationtype.resource.js index 7c542c5e7b..96c7882b5a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/relationtype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/relationtype.resource.js @@ -126,7 +126,7 @@ function relationTypeResource($q, $http, umbRequestHelper, umbDataFormatter) { options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/users.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/users.resource.js index 91f00a36e3..0b69bec3f5 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/users.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/users.resource.js @@ -226,7 +226,7 @@ options = {}; } //overwrite the defaults if there are any specified - angular.extend(defaults, options); + Utilities.extend(defaults, options); //now copy back to the options we will use options = defaults; //change asc/desct diff --git a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js index 31375c5c56..b49e809eeb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js @@ -264,7 +264,7 @@ function keyboardService($window, $timeout) { var elt; // Initialize opt object - opt = angular.extend({}, defaultOpt, opt); + opt = Utilities.extend(defaultOpt, opt); label = label.toLowerCase(); elt = opt.target; if(typeof opt.target === 'string'){ diff --git a/src/Umbraco.Web.UI.Client/src/common/services/searchresultformatter.service.js b/src/Umbraco.Web.UI.Client/src/common/services/searchresultformatter.service.js index 9bf9f3762c..ca8fdc7fa7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/searchresultformatter.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/searchresultformatter.service.js @@ -3,27 +3,27 @@ function searchResultFormatter(umbRequestHelper) { function configureDefaultResult(content, treeAlias, appAlias) { content.editorPath = appAlias + "/" + treeAlias + "/edit/" + content.id; - angular.extend(content.metaData, { treeAlias: treeAlias }); + Utilities.extend(content.metaData, { treeAlias: treeAlias }); } function configureContentResult(content, treeAlias, appAlias) { content.menuUrl = umbRequestHelper.getApiUrl("contentTreeBaseUrl", "GetMenu", [{ id: content.id }, { application: appAlias }]); content.editorPath = appAlias + "/" + treeAlias + "/edit/" + content.id; - angular.extend(content.metaData, { treeAlias: treeAlias }); + Utilities.extend(content.metaData, { treeAlias: treeAlias }); content.subTitle = content.metaData.Url; } function configureMemberResult(member, treeAlias, appAlias) { member.menuUrl = umbRequestHelper.getApiUrl("memberTreeBaseUrl", "GetMenu", [{ id: member.id }, { application: appAlias }]); member.editorPath = appAlias + "/" + treeAlias + "/edit/" + (member.key ? member.key : member.id); - angular.extend(member.metaData, { treeAlias: treeAlias }); + Utilities.extend(member.metaData, { treeAlias: treeAlias }); member.subTitle = member.metaData.Email; } function configureMediaResult(media, treeAlias, appAlias) { media.menuUrl = umbRequestHelper.getApiUrl("mediaTreeBaseUrl", "GetMenu", [{ id: media.id }, { application: appAlias }]); media.editorPath = appAlias + "/" + treeAlias + "/edit/" + media.id; - angular.extend(media.metaData, { treeAlias: treeAlias }); + Utilities.extend(media.metaData, { treeAlias: treeAlias }); } return { @@ -34,4 +34,4 @@ function searchResultFormatter(umbRequestHelper) { }; } -angular.module('umbraco.services').factory('searchResultFormatter', searchResultFormatter); \ No newline at end of file +angular.module('umbraco.services').factory('searchResultFormatter', searchResultFormatter); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 9b5d240776..fbe342d44f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -463,8 +463,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s }; - angular.extend(config, pasteConfig); - + Utilities.extend(config, pasteConfig); if (tinyMceConfig.customConfig) { @@ -481,7 +480,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s //overwrite the baseline config item if it is an array, we want to concat the items in the array, otherwise //if it's an object it will overwrite the baseline if (Utilities.isArray(config[i]) && Utilities.isArray(tinyMceConfig.customConfig[i])) { - //concat it and below this concat'd array will overwrite the baseline in angular.extend + //concat it and below this concat'd array will overwrite the baseline in Utilities.extend tinyMceConfig.customConfig[i] = config[i].concat(tinyMceConfig.customConfig[i]); } } @@ -498,7 +497,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s } } - angular.extend(config, tinyMceConfig.customConfig); + Utilities.extend(config, tinyMceConfig.customConfig); } return config; diff --git a/src/Umbraco.Web.UI.Client/src/utilities.js b/src/Umbraco.Web.UI.Client/src/utilities.js index 01e18e4e1c..abbc287e0f 100644 --- a/src/Umbraco.Web.UI.Client/src/utilities.js +++ b/src/Umbraco.Web.UI.Client/src/utilities.js @@ -33,8 +33,9 @@ /** * Facade to angular.extend * Use this with Angular objects, for vanilla JS objects, use Object.assign() + * This is an alias as it to allow passing an unknown number of arguments */ - const extend = (dst, src) => angular.extend(dst, src); + const extend = angular.extend; /** * Equivalent to angular.isFunction diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/colorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/colorpicker.controller.js index 9ad2c87ab4..c3f0314389 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/colorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/colorpicker.controller.js @@ -7,7 +7,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.ColorPickerControl }; //map the user config - angular.extend(config, $scope.model.config); + Utilities.extend(config, $scope.model.config); //map back to the model $scope.model.config = config; diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js index 4258229042..65e5fa906f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediapicker.controller.js @@ -23,7 +23,7 @@ function mediaPickerController($scope, entityResource, iconHelper, editorService //combine the dialogOptions with any values returned from the server if ($scope.model.config) { - angular.extend(dialogOptions, $scope.model.config); + Utilities.extend(dialogOptions, $scope.model.config); } $scope.openTreePicker = function () { diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js index 0359043da4..1b490d86d3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treepicker.controller.js @@ -21,7 +21,7 @@ angular.module('umbraco') //combine the config with any values returned from the server if ($scope.model.config) { - angular.extend(config, $scope.model.config); + Utilities.extend(config, $scope.model.config); } if ($scope.model.value) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index e818fe9a23..d8c7b3e76a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -130,7 +130,7 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso delete $scope.model.config.startNode; } //merge the server config on top of the default config, then set the server config to use the result - $scope.model.config = angular.extend(defaultConfig, $scope.model.config); + $scope.model.config = Utilities.extend(defaultConfig, $scope.model.config); // if the property is mandatory, set the minCount config to 1 (unless of course it is set to something already), // that way the minCount/maxCount validation handles the mandatory as well @@ -189,7 +189,7 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso //since most of the pre-value config's are used in the dialog options (i.e. maxNumber, minNumber, etc...) we'll merge the // pre-value config on to the dialog options - angular.extend(dialogOptions, $scope.model.config); + Utilities.extend(dialogOptions, $scope.model.config); dialogOptions.dataTypeKey = $scope.model.dataTypeKey; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js index af1dea167a..3ec7e191f9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/datepicker/datepicker.controller.js @@ -24,7 +24,7 @@ function dateTimePickerController($scope, angularHelper, dateHelper, validationM }; // map the user config - $scope.model.config = angular.extend(config, $scope.model.config); + $scope.model.config = Utilities.extend(config, $scope.model.config);; // ensure the format doesn't get overwritten with an empty string if ($scope.model.config.format === "" || $scope.model.config.format === undefined || $scope.model.config.format === null) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js index 4064df6a24..d62d521d17 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/dropdownFlexible/dropdownFlexible.controller.js @@ -8,7 +8,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.DropdownFlexibleCo }; //map the user config - angular.extend(config, $scope.model.config); + Utilities.extend(config, $scope.model.config); //map back to the model $scope.model.config = config; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js index 15f5ceaa88..983644767d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js @@ -753,7 +753,7 @@ angular.module("umbraco") // allowed for this template based on the current config. _.each(found.sections, function (templateSection, index) { - angular.extend($scope.model.value.sections[index], Utilities.copy(templateSection)); + Utilities.extend($scope.model.value.sections[index], Utilities.copy(templateSection)); }); } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js index e9d9950bdd..cbaf843d35 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js @@ -43,7 +43,7 @@ angular.module('umbraco') function setModelValueWithSrc(src) { if (!$scope.model.value || !$scope.model.value.src) { //we are copying to not overwrite the original config - $scope.model.value = angular.extend(Utilities.copy($scope.model.config), { src: src }); + $scope.model.value = Utilities.extend(Utilities.copy($scope.model.config), { src: src }); } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js index c6320a7cf2..bdd3251ca7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/mediapicker/mediapicker.controller.js @@ -116,7 +116,7 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl media.loading = true; entityResource.getById(media.udi, "Media") .then(function (mediaEntity) { - angular.extend(media, mediaEntity); + Utilities.extend(media, mediaEntity); media.thumbnail = mediaHelper.resolveFileFromEntity(media, true); media.loading = false; }); @@ -226,7 +226,7 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl // we need to update all the media items vm.mediaItems.forEach(media => { if (media.id === model.mediaNode.id) { - angular.extend(media, mediaEntity); + Utilities.extend(media, mediaEntity); media.thumbnail = mediaHelper.resolveFileFromEntity(media, true); } }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/memberpicker/memberpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/memberpicker/memberpicker.controller.js index 315eb18ee4..0aa01a560b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/memberpicker/memberpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/memberpicker/memberpicker.controller.js @@ -40,7 +40,7 @@ function memberPickerController($scope, entityResource, iconHelper, editorServic //since most of the pre-value config's are used in the dialog options (i.e. maxNumber, minNumber, etc...) we'll merge the // pre-value config on to the dialog options if ($scope.model.config) { - angular.extend(dialogOptions, $scope.model.config); + Utilities.extend(dialogOptions, $scope.model.config); } $scope.openMemberPicker = function () { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index 9faa012a4d..1b7a96309a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -86,8 +86,8 @@ angular.module("umbraco") }); }; - - angular.extend(baseLineConfigObj, standardConfig); + + Utilities.extend(baseLineConfigObj, standardConfig); // We need to wait for DOM to have rendered before we can find the element by ID. $timeout(function () {