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

Commit 21258da

Browse files
committed
v7.3.3
2 parents 589e7dc + a3ed449 commit 21258da

File tree

8 files changed

+74
-81
lines changed

8 files changed

+74
-81
lines changed

dist/formly.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* angular-formly JavaScript Library v7.3.2
2+
* angular-formly JavaScript Library v7.3.3
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.2")); // <-- webpack variable
156+
ngModule.constant('formlyVersion', ("7.3.3")); // <-- 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.2") + "/other/ERRORS_AND_WARNINGS.md#";
427+
exports["default"] = "https://github.com/formly-js/angular-formly/blob/" + ("7.3.3") + "/other/ERRORS_AND_WARNINGS.md#";
428428
module.exports = exports["default"];
429429

430430
/***/ },
@@ -1539,17 +1539,22 @@ return /******/ (function(modules) { // webpackBootstrap
15391539
stopWatchingShowError = scope.$watch(function watchShowValidationChange() {
15401540
var customExpression = formlyConfig.extras.errorExistsAndShouldBeVisibleExpression;
15411541
var options = scope.options;
1542-
var fc = scope.fc;
1543-
1544-
if (!fc.$invalid) {
1542+
var formControls = arrayify(scope.fc);
1543+
if (!formControls.some(function (fc) {
1544+
return fc.$invalid;
1545+
})) {
15451546
return false;
15461547
} else if (typeof options.validation.show === 'boolean') {
15471548
return options.validation.show;
15481549
} else if (customExpression) {
1549-
return formlyUtil.formlyEval(scope, customExpression, fc.$modelValue, fc.$viewValue);
1550+
return formControls.some(function (fc) {
1551+
return formlyUtil.formlyEval(scope, customExpression, fc.$modelValue, fc.$viewValue);
1552+
});
15501553
} else {
1551-
var noTouchedButDirty = _angularFix2['default'].isUndefined(fc.$touched) && fc.$dirty;
1552-
return scope.fc.$touched || noTouchedButDirty;
1554+
return formControls.some(function (fc) {
1555+
var noTouchedButDirty = _angularFix2['default'].isUndefined(fc.$touched) && fc.$dirty;
1556+
return fc.$touched || noTouchedButDirty;
1557+
});
15531558
}
15541559
}, function onShowValidationChange(show) {
15551560
scope.options.validation.errorExistsAndShouldBeVisible = show;
@@ -2627,22 +2632,16 @@ return /******/ (function(modules) { // webpackBootstrap
26272632

26282633
// @ngInject
26292634
function addCustomTags($document) {
2630-
if ($document && $document.get) {
2635+
// IE8 check ->
2636+
// https://msdn.microsoft.com/en-us/library/cc196988(v=vs.85).aspx
2637+
if ($document && $document.documentMode < 9) {
26312638
(function () {
2632-
// IE8 check ->
2633-
// http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript/10965203#10965203
26342639
var document = $document.get(0);
2635-
var div = document.createElement('div');
2636-
div.innerHTML = '<!--[if lt IE 9]><i></i><![endif]-->';
2637-
var isIeLessThan9 = div.getElementsByTagName('i').length === 1;
2638-
2639-
if (isIeLessThan9) {
2640-
// add the custom elements that we need for formly
2641-
var customElements = ['formly-field', 'formly-form', 'formly-custom-validation', 'formly-focus', 'formly-transpose'];
2642-
_angularFix2['default'].forEach(customElements, function (el) {
2643-
document.createElement(el);
2644-
});
2645-
}
2640+
// add the custom elements that we need for formly
2641+
var customElements = ['formly-field', 'formly-form'];
2642+
_angularFix2['default'].forEach(customElements, function (el) {
2643+
document.createElement(el);
2644+
});
26462645
})();
26472646
}
26482647
}

dist/formly.min.js

Lines changed: 22 additions & 23 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-formly",
3-
"version": "7.3.2",
3+
"version": "7.3.3",
44
"author": "Astrism <[email protected]>",
55
"contributors": [
66
"Astrism <[email protected]>",
@@ -42,7 +42,7 @@
4242
},
4343
"config": {
4444
"ghooks": {
45-
"commit-msg": "./node_modules/.bin/validate-commit-msg && npm run eslint && npm t && npm run check-coverage"
45+
"commit-msg": "validate-commit-msg && npm run eslint && npm t && npm run check-coverage"
4646
},
4747
"commitizen": {
4848
"path": "node_modules/cz-conventional-changelog"
@@ -71,7 +71,7 @@
7171
"eslint-config-kentcdodds": "5.0.0",
7272
"eslint-loader": "1.1.0",
7373
"eslint-plugin-mocha": "1.0.0",
74-
"ghooks": "0.3.2",
74+
"ghooks": "1.0.0",
7575
"http-server": "0.8.5",
7676
"isparta": "3.1.0",
7777
"isparta-loader": "1.0.0",

src/directives/formly-field.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,16 +374,20 @@ function formlyField($http, $q, $compile, $templateCache, $interpolate, formlyCo
374374
function addShowMessagesWatcher() {
375375
stopWatchingShowError = scope.$watch(function watchShowValidationChange() {
376376
const customExpression = formlyConfig.extras.errorExistsAndShouldBeVisibleExpression
377-
const {options, fc} = scope
378-
if (!fc.$invalid) {
377+
const options = scope.options
378+
const formControls = arrayify(scope.fc)
379+
if (!formControls.some(fc => fc.$invalid)) {
379380
return false
380381
} else if (typeof options.validation.show === 'boolean') {
381382
return options.validation.show
382383
} else if (customExpression) {
383-
return formlyUtil.formlyEval(scope, customExpression, fc.$modelValue, fc.$viewValue)
384+
return formControls.some(fc =>
385+
formlyUtil.formlyEval(scope, customExpression, fc.$modelValue, fc.$viewValue))
384386
} else {
385-
const noTouchedButDirty = (angular.isUndefined(fc.$touched) && fc.$dirty)
386-
return (scope.fc.$touched || noTouchedButDirty)
387+
return formControls.some(fc => {
388+
const noTouchedButDirty = (angular.isUndefined(fc.$touched) && fc.$dirty)
389+
return (fc.$touched || noTouchedButDirty)
390+
})
387391
}
388392
}, function onShowValidationChange(show) {
389393
scope.options.validation.errorExistsAndShouldBeVisible = show

src/directives/formly-field.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ describe('formly-field', function() {
13661366
})
13671367

13681368
describe(`options.validation.errorExistsAndShouldBeVisible`, () => {
1369-
describe.skip(`multiple ng-model elements`, () => {
1369+
describe(`multiple ng-model elements`, () => {
13701370
beforeEach(() => {
13711371
scope.fields = [
13721372
{
@@ -1396,7 +1396,7 @@ describe('formly-field', function() {
13961396
compileAndDigest()
13971397

13981398
invalidateAndTouchFields()
1399-
expect(spy).to.have.been.calledWith(sinon.match.array, sinon.match.array)
1399+
expect(spy).to.have.been.calledTwice // once for each form control.
14001400
})
14011401

14021402
function invalidateAndTouchFields() {

src/run/formlyCustomTags.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@ export default addCustomTags
33

44
// @ngInject
55
function addCustomTags($document) {
6-
if ($document && $document.get) {
7-
// IE8 check ->
8-
// http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript/10965203#10965203
6+
// IE8 check ->
7+
// https://msdn.microsoft.com/en-us/library/cc196988(v=vs.85).aspx
8+
if ($document && $document.documentMode < 9) {
99
const document = $document.get(0)
10-
const div = document.createElement('div')
11-
div.innerHTML = '<!--[if lt IE 9]><i></i><![endif]-->'
12-
const isIeLessThan9 = (div.getElementsByTagName('i').length === 1)
13-
14-
if (isIeLessThan9) {
15-
// add the custom elements that we need for formly
16-
const customElements = [
17-
'formly-field', 'formly-form', 'formly-custom-validation', 'formly-focus', 'formly-transpose',
18-
]
19-
angular.forEach(customElements, el => {
20-
document.createElement(el)
21-
})
22-
}
10+
// add the custom elements that we need for formly
11+
const customElements = [
12+
'formly-field', 'formly-form',
13+
]
14+
angular.forEach(customElements, el => {
15+
document.createElement(el)
16+
})
2317
}
2418
}

src/run/formlyCustomTags.test.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import angular from 'angular'
33
describe(`formlyCustomTags`, () => {
44

55
beforeEach(window.module(`formly`, $provide => {
6-
const docStub = {
6+
$provide.value(`$document`, {
7+
documentMode: 8,
78
get: sinon.stub().withArgs(0).returnsThis(),
8-
createElement: sinon.stub().withArgs(`div`).returns({
9-
getElementsByTagName: sinon.stub().withArgs(`i`).returns([1]),
10-
}),
11-
}
12-
13-
$provide.value(`$document`, docStub)
9+
createElement: sinon.spy(),
10+
})
1411
}))
1512

1613
let $document
@@ -22,7 +19,7 @@ describe(`formlyCustomTags`, () => {
2219
describe(`addCustomTags`, () => {
2320
it(`should create custom formly tags`, () => {
2421
const customElements = [
25-
`div`, `formly-field`, `formly-form`, `formly-custom-validation`, `formly-focus`, `formly-transpose`,
22+
`formly-field`, `formly-form`,
2623
]
2724

2825
expect($document.get).to.have.been.calledOnce

0 commit comments

Comments
 (0)