|
1 | | -//! angular-formly version 7.0.1 built with ♥ by Astrism <[email protected]>, Kent C. Dodds <[email protected]> (ó ì_í)=óò=(ì_í ò) |
| 1 | +//! angular-formly version 7.1.0 built with ♥ by Astrism <[email protected]>, Kent C. Dodds <[email protected]> (ó ì_í)=óò=(ì_í ò) |
2 | 2 |
|
3 | 3 | (function webpackUniversalModuleDefinition(root, factory) { |
4 | 4 | if(typeof exports === 'object' && typeof module === 'object') |
@@ -147,7 +147,7 @@ return /******/ (function(modules) { // webpackBootstrap |
147 | 147 |
|
148 | 148 | ngModule.constant('formlyApiCheck', _providersFormlyApiCheck2['default']); |
149 | 149 | ngModule.constant('formlyErrorAndWarningsUrlPrefix', _otherDocsBaseUrl2['default']); |
150 | | - ngModule.constant('formlyVersion', ("7.0.1")); // <-- webpack variable |
| 150 | + ngModule.constant('formlyVersion', ("7.1.0")); // <-- webpack variable |
151 | 151 |
|
152 | 152 | ngModule.provider('formlyUsability', _providersFormlyUsability2['default']); |
153 | 153 | ngModule.provider('formlyConfig', _providersFormlyConfig2['default']); |
@@ -355,7 +355,7 @@ return /******/ (function(modules) { // webpackBootstrap |
355 | 355 | removeChromeAutoComplete: apiCheck.bool.optional, |
356 | 356 | templateManipulators: templateManipulators.optional, |
357 | 357 | wrapper: specifyWrapperType.optional, |
358 | | - fieldTransform: apiCheck.func.optional, |
| 358 | + fieldTransform: apiCheck.oneOfType([apiCheck.func, apiCheck.array]).optional, |
359 | 359 | data: apiCheck.object.optional |
360 | 360 | }).strict; |
361 | 361 |
|
@@ -416,7 +416,7 @@ return /******/ (function(modules) { // webpackBootstrap |
416 | 416 | Object.defineProperty(exports, "__esModule", { |
417 | 417 | value: true |
418 | 418 | }); |
419 | | - exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.0.1") + "/other/ERRORS_AND_WARNINGS.md#"; |
| 419 | + exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.1.0") + "/other/ERRORS_AND_WARNINGS.md#"; |
420 | 420 | module.exports = exports["default"]; |
421 | 421 |
|
422 | 422 | /***/ }, |
@@ -2047,21 +2047,38 @@ return /******/ (function(modules) { // webpackBootstrap |
2047 | 2047 |
|
2048 | 2048 | function setupFields() { |
2049 | 2049 | $scope.fields = $scope.fields || []; |
2050 | | - var fieldTransform = $scope.options.fieldTransform || formlyConfig.extras.fieldTransform; |
2051 | 2050 |
|
2052 | | - if (fieldTransform) { |
2053 | | - $scope.fields = fieldTransform($scope.fields, $scope.model, $scope.options, $scope.form); |
2054 | | - if (!$scope.fields) { |
2055 | | - throw formlyUsability.getFormlyError('fieldTransform must return an array of fields'); |
2056 | | - } |
| 2051 | + checkDeprecatedOptions($scope.options); |
| 2052 | + |
| 2053 | + var fieldTransforms = $scope.options.fieldTransform || formlyConfig.extras.fieldTransform; |
| 2054 | + |
| 2055 | + if (!_angularFix2['default'].isArray(fieldTransforms)) { |
| 2056 | + fieldTransforms = [fieldTransforms]; |
2057 | 2057 | } |
2058 | 2058 |
|
| 2059 | + _angularFix2['default'].forEach(fieldTransforms, function transformFields(fieldTransform) { |
| 2060 | + if (fieldTransform) { |
| 2061 | + $scope.fields = fieldTransform($scope.fields, $scope.model, $scope.options, $scope.form); |
| 2062 | + if (!$scope.fields) { |
| 2063 | + throw formlyUsability.getFormlyError('fieldTransform must return an array of fields'); |
| 2064 | + } |
| 2065 | + } |
| 2066 | + }); |
| 2067 | + |
2059 | 2068 | setupModels(); |
2060 | 2069 |
|
2061 | 2070 | _angularFix2['default'].forEach($scope.fields, attachKey); // attaches a key based on the index if a key isn't specified |
2062 | 2071 | _angularFix2['default'].forEach($scope.fields, setupWatchers); // setup watchers for all fields |
2063 | 2072 | } |
2064 | 2073 |
|
| 2074 | + function checkDeprecatedOptions(options) { |
| 2075 | + if (formlyConfig.extras.fieldTransform && _angularFix2['default'].isFunction(formlyConfig.extras.fieldTransform)) { |
| 2076 | + formlyWarn('fieldtransform-as-a-function-deprecated', 'fieldTransform as a function has been deprecated.', 'Attempted for formlyConfig.extras: ' + formlyConfig.extras.fieldTransform.name, formlyConfig.extras); |
| 2077 | + } else if (options.fieldTransform && _angularFix2['default'].isFunction(options.fieldTransform)) { |
| 2078 | + formlyWarn('fieldtransform-as-a-function-deprecated', 'fieldTransform as a function has been deprecated.', 'Attempted for form', options); |
| 2079 | + } |
| 2080 | + } |
| 2081 | + |
2065 | 2082 | function setupOptions() { |
2066 | 2083 | formlyApiCheck['throw']([formlyApiCheck.formOptionsApi.optional], [$scope.options], { prefix: 'formly-form options check' }); |
2067 | 2084 | $scope.options = $scope.options || {}; |
|
0 commit comments