Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit cc8ba00

Browse files
committed
v7.3.7
2 parents d521c7e + 5cccd5d commit cc8ba00

File tree

7 files changed

+76
-15
lines changed

7 files changed

+76
-15
lines changed

dist/formly.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* angular-formly JavaScript Library v7.3.6
2+
* angular-formly JavaScript Library v7.3.7
33
*
44
* @license MIT (http://license.angular-formly.com)
55
*
@@ -153,7 +153,7 @@ return /******/ (function(modules) { // webpackBootstrap
153153

154154
ngModule.constant('formlyApiCheck', _providersFormlyApiCheck2['default']);
155155
ngModule.constant('formlyErrorAndWarningsUrlPrefix', _otherDocsBaseUrl2['default']);
156-
ngModule.constant('formlyVersion', ("7.3.6")); // <-- webpack variable
156+
ngModule.constant('formlyVersion', ("7.3.7")); // <-- webpack variable
157157

158158
ngModule.provider('formlyUsability', _providersFormlyUsability2['default']);
159159
ngModule.provider('formlyConfig', _providersFormlyConfig2['default']);
@@ -424,7 +424,7 @@ return /******/ (function(modules) { // webpackBootstrap
424424
Object.defineProperty(exports, "__esModule", {
425425
value: true
426426
});
427-
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.3.6") + "/other/ERRORS_AND_WARNINGS.md#";
427+
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.3.7") + "/other/ERRORS_AND_WARNINGS.md#";
428428
module.exports = exports["default"];
429429

430430
/***/ },
@@ -846,9 +846,21 @@ return /******/ (function(modules) { // webpackBootstrap
846846
var _angularFix2 = _interopRequireDefault(_angularFix);
847847

848848
exports['default'] = {
849-
formlyEval: formlyEval, getFieldId: getFieldId, reverseDeepMerge: reverseDeepMerge, findByNodeName: findByNodeName, arrayify: arrayify, extendFunction: extendFunction, extendArray: extendArray, startsWith: startsWith, contains: contains
849+
containsSelector: containsSelector, containsSpecialChar: containsSpecialChar, formlyEval: formlyEval, getFieldId: getFieldId, reverseDeepMerge: reverseDeepMerge, findByNodeName: findByNodeName,
850+
arrayify: arrayify, extendFunction: extendFunction, extendArray: extendArray, startsWith: startsWith, contains: contains
850851
};
851852

853+
function containsSelector(string) {
854+
return containsSpecialChar(string, '.') || containsSpecialChar(string, '[') && containsSpecialChar(string, ']');
855+
}
856+
857+
function containsSpecialChar(a, b) {
858+
if (!a || !a.indexOf) {
859+
return false;
860+
}
861+
return a.indexOf(b) !== -1;
862+
}
863+
852864
function formlyEval(scope, expression, $modelValue, $viewValue, extraLocals) {
853865
if (_angularFix2['default'].isFunction(expression)) {
854866
return expression($viewValue, $modelValue, scope, extraLocals);
@@ -1268,7 +1280,7 @@ return /******/ (function(modules) { // webpackBootstrap
12681280
}
12691281

12701282
function shouldNotUseParseKey(key) {
1271-
return _angularFix2['default'].isNumber(key) || /^\d/.test(key) && key.indexOf('[') === -1;
1283+
return _angularFix2['default'].isNumber(key) || !formlyUtil.containsSelector(key);
12721284
}
12731285

12741286
function parseSet(key, model, newVal) {

dist/formly.min.js

Lines changed: 17 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/formly.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-formly",
3-
"version": "7.3.6",
3+
"version": "7.3.7",
44
"author": "Astrism <[email protected]>",
55
"contributors": [
66
"Astrism <[email protected]>",

src/directives/formly-field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function formlyField($http, $q, $compile, $templateCache, $interpolate, formlyCo
8383
}
8484

8585
function shouldNotUseParseKey(key) {
86-
return angular.isNumber(key) || (/^\d/.test(key) && key.indexOf('[') === -1)
86+
return angular.isNumber(key) || !formlyUtil.containsSelector(key)
8787
}
8888

8989
function parseSet(key, model, newVal) {

src/directives/formly-field.test.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,30 @@ describe('formly-field', function() {
572572
expect(scope.model[key]).to.eq(defaultValue)
573573
})
574574

575+
it('should work with dashes in the key', () => {
576+
const key = 'address-1st-line'
577+
const defaultValue = 'baz'
578+
scope.fields = [
579+
{template: input, key, defaultValue},
580+
]
581+
scope.model = {}
582+
583+
compileAndDigest()
584+
expect(scope.model[key]).to.eq(defaultValue)
585+
})
586+
587+
it('should work with dashes and numerics in the key', () => {
588+
const key = 'b141c66a-2857-4196-847b-b2096fa6170d'
589+
const defaultValue = 'baz'
590+
scope.fields = [
591+
{template: input, key, defaultValue},
592+
]
593+
scope.model = {}
594+
595+
compileAndDigest()
596+
expect(scope.model[key]).to.eq(defaultValue)
597+
})
598+
575599
it('should work with nested keys with numbers in the key', () => {
576600
const key = 'foo3bar.baz4foobar'
577601
const defaultValue = 'baz'
@@ -581,7 +605,7 @@ describe('formly-field', function() {
581605
scope.model = {}
582606

583607
compileAndDigest()
584-
expect(scope.model.foo3bar.baz4foobar).to.equal(defaultValue)
608+
expect(scope.model.foo3bar.baz4foobar).to.eq(defaultValue)
585609
})
586610
})
587611

src/other/utils.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
import angular from 'angular-fix'
22

33
export default {
4-
formlyEval, getFieldId, reverseDeepMerge, findByNodeName, arrayify, extendFunction, extendArray, startsWith, contains,
4+
containsSelector, containsSpecialChar, formlyEval, getFieldId, reverseDeepMerge, findByNodeName,
5+
arrayify, extendFunction, extendArray, startsWith, contains,
56
}
67

8+
function containsSelector(string) {
9+
return containsSpecialChar(string, '.') || (containsSpecialChar(string, '[') && containsSpecialChar(string, ']'))
10+
}
11+
12+
function containsSpecialChar(a, b) {
13+
if (!a || !a.indexOf) {
14+
return false
15+
}
16+
return a.indexOf(b) !== -1
17+
}
18+
19+
720
function formlyEval(scope, expression, $modelValue, $viewValue, extraLocals) {
821
if (angular.isFunction(expression)) {
922
return expression($viewValue, $modelValue, scope, extraLocals)

0 commit comments

Comments
 (0)