Skip to content

Commit 47eb895

Browse files
Merge pull request #404 from dxvladislavvolkov/support-angular4
Support angular 4
2 parents 1efdc92 + 66b7e9a commit 47eb895

File tree

7 files changed

+37
-21
lines changed

7 files changed

+37
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Unreleased
2+
3+
### Features
4+
5+
- Support for Angular 4 RC has been provided ([#386](https://github.com/DevExpress/devextreme-angular/issues/386)).
6+
17
## 16.2.5
28

39
### Features

gulpfile.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ gulp.task('clean.tests', function () {
217217
return del([outputFolderPath]);
218218
});
219219

220-
gulp.task('build.tests', ['build.components', 'clean.tests'], function() {
220+
gulp.task('build.tests', ['clean.tests'], function() {
221221
var config = buildConfig.components,
222222
testConfig = buildConfig.tests;
223223

@@ -232,21 +232,21 @@ gulp.task('watch.spec', function() {
232232
gulp.watch(buildConfig.components.tsTestSrc, ['build.tests']);
233233
});
234234

235-
gulp.task('test.components', ['build.tests'], function(done) {
235+
gulp.task('test.components', function(done) {
236236
new karmaServer({
237237
configFile: __dirname + '/karma.conf.js'
238238
}, done).start();
239239
});
240240

241-
gulp.task('test.components.debug', ['build.tests'], function(done) {
241+
gulp.task('test.components.debug', function(done) {
242242
new karmaServer({
243243
configFile: __dirname + '/karma.conf.js',
244244
browsers: [ 'Chrome' ],
245245
singleRun: false
246246
}, done).start();
247247
});
248248

249-
gulp.task('test.tools', ['build.tools'], function(done) {
249+
gulp.task('test.tools', function(done) {
250250
var config = buildConfig.tools.tests;
251251

252252
return gulp.src(config.srcFilesPattern)
@@ -265,13 +265,19 @@ gulp.task('test.tools', ['build.tools'], function(done) {
265265
}));
266266
});
267267

268-
gulp.task('test', function(done) {
268+
gulp.task('run.tests', function(done) {
269269
runSequence(
270270
['test.tools', 'test.components'],
271271
'lint',
272272
done);
273273
});
274274

275+
gulp.task('test', function(done) {
276+
runSequence(
277+
'build', 'build.tests', 'run.tests',
278+
done);
279+
});
280+
275281
gulp.task('watch.test', function(done) {
276282
new karmaServer({
277283
configFile: __dirname + '/karma.conf.js'

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@
1616
"author": "Developer Express Inc.",
1717
"license": "MIT",
1818
"dependencies": {
19-
"@types/jquery": "^2.0.0 || ^3.0.0",
20-
"jquery": "^2.0.0 || ^3.0.0"
19+
"@types/jquery": "2.0.0 - 3.1",
20+
"jquery": "2.0.0 - 3.1"
2121
},
2222
"peerDependencies": {
2323
"devextreme": "~16.2.4",
24-
"@angular/core": "^2.2.1",
25-
"@angular/common": "^2.2.1",
26-
"@angular/forms": "^2.2.1"
24+
"@angular/core": "^2.2.1 || ^4.0.0-rc.1",
25+
"@angular/common": "^2.2.1 || ^4.0.0-rc.1",
26+
"@angular/forms": "^2.2.1 || ^4.0.0-rc.1"
2727
},
2828
"devDependencies": {
2929
"devextreme": "~16.2.4",
30-
"jquery": "^2.0.0 || ^3.0.0",
3130
"zone.js": "^0.7.2",
3231
"@angular/core": "^2.2.1",
3332
"@angular/common": "^2.2.1",

shippable.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ build:
2121

2222
ci:
2323
- shippable_retry npm install --unsafe-perm
24-
- gulp test
24+
- gulp test
25+
- shippable_retry npm install @angular/core@~4.0.0-0 @angular/common@~4.0.0-0 @angular/forms@~4.0.0-0 @angular/compiler@~4.0.0-0 @angular/platform-browser@~4.0.0-0 @angular/platform-browser-dynamic@~4.0.0-0 --unsafe-perm
26+
- gulp run.tests

src/core/iterable-differ-helper.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import {
22
Injectable,
33
SimpleChanges,
4-
IterableDiffers,
5-
IterableDiffer,
6-
ChangeDetectorRef,
7-
DefaultIterableDiffer
4+
IterableDiffers
85
} from '@angular/core';
96

107
import {
@@ -15,9 +12,9 @@ import {
1512
export class IterableDifferHelper {
1613

1714
private _host: DxComponent;
18-
private _propertyDiffers: { [id: string]: IterableDiffer; } = {};
15+
private _propertyDiffers: { [id: string]: any; } = {};
1916

20-
constructor(private _differs: IterableDiffers, private _cdr: ChangeDetectorRef) { }
17+
constructor(private _differs: IterableDiffers) { }
2118

2219
setHost(host: DxComponent) {
2320
this._host = host;
@@ -29,7 +26,7 @@ export class IterableDifferHelper {
2926
if (value && Array.isArray(value)) {
3027
if (!this._propertyDiffers[prop]) {
3128
try {
32-
this._propertyDiffers[prop] = this._differs.find(value).create(this._cdr, null);
29+
this._propertyDiffers[prop] = this._differs.find(value).create(null);
3330
} catch (e) { }
3431
}
3532
} else {
@@ -40,7 +37,7 @@ export class IterableDifferHelper {
4037

4138
doCheck(prop: string) {
4239
if (this._propertyDiffers[prop]) {
43-
const changes = <DefaultIterableDiffer>this._propertyDiffers[prop].diff(this._host[prop]);
40+
const changes = this._propertyDiffers[prop].diff(this._host[prop]);
4441
if (changes && this._host.instance) {
4542
this._host.instance.option(prop, this._host[prop]);
4643
}

src/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"declaration": true,
1212
"noUnusedParameters": true,
1313
"noUnusedLocals": true,
14-
"lib": ["es2015", "dom"]
14+
"lib": ["es2015", "es2015.iterable", "dom"]
1515
},
1616
"filesGlob": [
1717
"**/*.ts"

templates/component.tst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ export class <#= it.className #>Component extends <#= baseClass #> <#? implement
116116
}
117117

118118
protected _createInstance(element, options) {
119+
// =========== WORKAROUND =============
120+
// https://github.com/angular/angular/issues/15143
121+
if (element.firstChild && element.firstChild.nodeType === Node.COMMENT_NODE) {
122+
element.removeChild(element.firstChild);
123+
}
124+
// =========== /WORKAROUND =============
119125
<#? it.isEditor #>let widget = new <#= it.className #>(element, options);
120126
if (this.validator) {
121127
this.validator.createInstance(element);

0 commit comments

Comments
 (0)