From 36034d4d1ac2aa767e6dca4e095aba4e4dd43a1a Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 27 Mar 2016 13:35:06 +0300 Subject: [PATCH 1/7] Minor fix joinAllOf --- lib/components/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/base.js b/lib/components/base.js index b039b7ce..d8582e5e 100644 --- a/lib/components/base.js +++ b/lib/components/base.js @@ -185,13 +185,13 @@ export class BaseComponent { throw new Error(errMessage); } - into.type = into.type || subSchema.type; if (into.type === 'array') { console.warn('allOf: subschemas with type array are not supported yet'); } // TODO: add check if can be merged correctly (no different properties with the same name) + into.type = into.type || subSchema.type; if (into.type === 'object' && subSchema.properties) { into.properties || (into.properties = {}); Object.assign(into.properties, subSchema.properties); From 4ca1bdb5dee9620b335ec35f235cafcddee9acbe Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 27 Mar 2016 18:25:46 +0300 Subject: [PATCH 2/7] updated angular2 to the latest beta (beta.12) --- build/tasks/build.js | 4 +-- karma.conf.js | 4 +-- .../StickySidebar/sticky-sidebar.spec.js | 6 ++--- lib/common/components/Tabs/tabs.js | 10 +++---- lib/common/components/Tabs/tabs.spec.js | 6 ++--- lib/common/components/Zippy/zippy.js | 6 ++--- lib/common/components/Zippy/zippy.spec.js | 6 ++--- lib/components/ApiInfo/api-info.spec.js | 6 ++--- lib/components/ApiLogo/api-logo.spec.js | 6 ++--- lib/components/JsonSchema/json-schema-lazy.js | 8 +++--- .../JsonSchema/json-schema-lazy.spec.js | 9 ++++--- lib/components/JsonSchema/json-schema.spec.js | 6 ++--- lib/components/Method/method.spec.js | 6 ++--- .../MethodsList/methods-list.spec.js | 6 ++--- lib/components/Redoc/redoc.spec.js | 6 ++--- lib/components/SideMenu/side-menu.spec.js | 6 ++--- lib/components/base.js | 9 +++---- lib/utils/SchemaManager.js | 1 + lib/utils/pipes.js | 6 ++--- package.json | 4 +-- system.config.js | 27 +++++-------------- 21 files changed, 62 insertions(+), 86 deletions(-) diff --git a/build/tasks/build.js b/build/tasks/build.js index 408cea9c..46fc4dfa 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -43,14 +43,14 @@ gulp.task('inlineTemplates', ['sass'], function() { var JS_DEV_DEPS = [ 'lib/utils/browser-update.js', - 'node_modules/zone.js/dist/zone-microtask.js', + 'node_modules/zone.js/dist/zone.js', 'node_modules/reflect-metadata/Reflect.js', 'node_modules/babel-polyfill/dist/polyfill.js' ]; var JS_DEV_DEPS_MIN = [ 'lib/utils/browser-update.js', - 'node_modules/zone.js/dist/zone-microtask.min.js', + 'node_modules/zone.js/dist/zone.min.js', 'node_modules/reflect-metadata/Reflect.js', 'node_modules/babel-polyfill/dist/polyfill.min.js' ] diff --git a/karma.conf.js b/karma.conf.js index 9d1d480d..bf73baac 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -45,9 +45,9 @@ module.exports = function (config) { }, //load angular dependencies and browser polyfills files: [ - 'node_modules/zone.js/dist/zone-microtask.js', - 'node_modules/zone.js/dist/long-stack-trace-zone.js', + 'node_modules/zone.js/dist/zone.js', 'node_modules/zone.js/dist/jasmine-patch.js', + 'node_modules/zone.js/dist/long-stack-trace-zone.js', 'node_modules/babel-polyfill/dist/polyfill.js', './node_modules/reflect-metadata/Reflect.js' ], diff --git a/lib/common/components/StickySidebar/sticky-sidebar.spec.js b/lib/common/components/StickySidebar/sticky-sidebar.spec.js index d77ea9eb..08cfe33c 100644 --- a/lib/common/components/StickySidebar/sticky-sidebar.spec.js +++ b/lib/common/components/StickySidebar/sticky-sidebar.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElementByType } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import {BrowserDomAdapter} from 'angular2/platform/browser'; import { @@ -60,8 +60,8 @@ describe('Common components', () => { /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [StickySidebar], template: `
diff --git a/lib/common/components/Tabs/tabs.js b/lib/common/components/Tabs/tabs.js index 44a6e8d9..d869df20 100644 --- a/lib/common/components/Tabs/tabs.js +++ b/lib/common/components/Tabs/tabs.js @@ -1,13 +1,11 @@ 'use strict'; -import {Component, View, EventEmitter} from 'angular2/core'; +import {Component, EventEmitter} from 'angular2/core'; import {CORE_DIRECTIVES} from 'angular2/common'; @Component({ selector: 'tabs', - events: ['change'] -}) -@View({ + events: ['change'], template: `
  • diff --git a/lib/common/components/Tabs/tabs.spec.js b/lib/common/components/Tabs/tabs.spec.js index 02e5ea70..dd8896f9 100644 --- a/lib/common/components/Tabs/tabs.spec.js +++ b/lib/common/components/Tabs/tabs.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement, getChildDebugElementAll } from 'tests/helpers'; -import {Component, View} from 'angular2/core'; +import {Component} from 'angular2/core'; import { TestComponentBuilder, @@ -137,8 +137,8 @@ describe('Common components', () => { /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [Tabs, Tab], template: ` diff --git a/lib/common/components/Zippy/zippy.js b/lib/common/components/Zippy/zippy.js index 9828d0c6..dda98d29 100644 --- a/lib/common/components/Zippy/zippy.js +++ b/lib/common/components/Zippy/zippy.js @@ -1,14 +1,12 @@ 'use strict'; -import {Component, View, EventEmitter} from 'angular2/core'; +import {Component, EventEmitter} from 'angular2/core'; import {CORE_DIRECTIVES} from 'angular2/common'; @Component({ selector: 'zippy', events: ['open', 'close'], - inputs: ['title', 'visible', 'type', 'empty'] -}) -@View({ + inputs: ['title', 'visible', 'type', 'empty'], templateUrl: './lib/common/components/Zippy/zippy.html', styleUrls: ['./lib/common/components/Zippy/zippy.css'], directives: [CORE_DIRECTIVES] diff --git a/lib/common/components/Zippy/zippy.spec.js b/lib/common/components/Zippy/zippy.spec.js index 193fa22b..55c3a68f 100644 --- a/lib/common/components/Zippy/zippy.spec.js +++ b/lib/common/components/Zippy/zippy.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement, mouseclick } from 'tests/helpers'; -import {Component, View} from 'angular2/core'; +import {Component} from 'angular2/core'; import { TestComponentBuilder, @@ -94,8 +94,8 @@ describe('Common components', () => { /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [Zippy], template: `test` diff --git a/lib/components/ApiInfo/api-info.spec.js b/lib/components/ApiInfo/api-info.spec.js index 83abf877..4b16d6f7 100644 --- a/lib/components/ApiInfo/api-info.spec.js +++ b/lib/components/ApiInfo/api-info.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import { TestComponentBuilder, @@ -53,8 +53,8 @@ describe('Redoc components', () => { /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [ApiInfo], template: `` diff --git a/lib/components/ApiLogo/api-logo.spec.js b/lib/components/ApiLogo/api-logo.spec.js index e2ebb319..41976344 100644 --- a/lib/components/ApiLogo/api-logo.spec.js +++ b/lib/components/ApiLogo/api-logo.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import { TestComponentBuilder, @@ -65,8 +65,8 @@ describe('Redoc components', () => { /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [ApiLogo], providers: [SchemaManager], template: diff --git a/lib/components/JsonSchema/json-schema-lazy.js b/lib/components/JsonSchema/json-schema-lazy.js index bbf20974..58922db7 100644 --- a/lib/components/JsonSchema/json-schema-lazy.js +++ b/lib/components/JsonSchema/json-schema-lazy.js @@ -1,6 +1,6 @@ 'use strict'; -import {Component, View, ElementRef} from 'angular2/core'; +import {Component, ElementRef} from 'angular2/core'; import {CORE_DIRECTIVES} from 'angular2/common'; import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; @@ -14,9 +14,7 @@ var cache = {}; @Component({ selector: 'json-schema-lazy', - inputs: ['pointer', 'auto'] -}) -@View({ + inputs: ['pointer', 'auto'], template: '', directives: [CORE_DIRECTIVES] }) @@ -41,6 +39,8 @@ export default class JsonSchemaLazy { if (this.pointer) { this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => { compRef.instance.pointer = this.pointer; + // trigger change detection + compRef.location.internalElement.parentView.changeDetector.detectChanges(); }); } this.loaded = true; diff --git a/lib/components/JsonSchema/json-schema-lazy.spec.js b/lib/components/JsonSchema/json-schema-lazy.spec.js index 65535b52..c8d10a5d 100644 --- a/lib/components/JsonSchema/json-schema-lazy.spec.js +++ b/lib/components/JsonSchema/json-schema-lazy.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; import {BrowserDomAdapter} from 'angular2/platform/browser'; @@ -25,7 +25,8 @@ describe('Redoc components', () => { let fixture; let loader; let appRef = { - instance: {} + instance: {}, + location: {internalElement: {parentView: {changeDetector: {detectChanges : function() {} }}}} }; beforeEachProviders(() => [ provide(SchemaManager, {useValue: schemaMgr}), @@ -80,8 +81,8 @@ describe('Redoc components', () => { /** Test component that contains a Method. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [JsonSchemaLazy], template: `` diff --git a/lib/components/JsonSchema/json-schema.spec.js b/lib/components/JsonSchema/json-schema.spec.js index dd7e9ef2..50a4bcb6 100644 --- a/lib/components/JsonSchema/json-schema.spec.js +++ b/lib/components/JsonSchema/json-schema.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import OptionsManager from 'lib/options'; import { @@ -64,8 +64,8 @@ describe('Redoc components', () => { /** Test component that contains a Method. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [JsonSchema], providers: [SchemaManager], template: diff --git a/lib/components/Method/method.spec.js b/lib/components/Method/method.spec.js index 9e5aee33..792b959e 100644 --- a/lib/components/Method/method.spec.js +++ b/lib/components/Method/method.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import {BrowserDomAdapter} from 'angular2/platform/browser'; import { @@ -57,8 +57,8 @@ describe('Redoc components', () => { /** Test component that contains a Method. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [Method], providers: [SchemaManager], template: diff --git a/lib/components/MethodsList/methods-list.spec.js b/lib/components/MethodsList/methods-list.spec.js index 50f62689..ce12b4c8 100644 --- a/lib/components/MethodsList/methods-list.spec.js +++ b/lib/components/MethodsList/methods-list.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, provide} from 'angular2/core'; +import {Component, provide} from 'angular2/core'; import OptionsManager from 'lib/options'; import {BrowserDomAdapter} from 'angular2/platform/browser'; @@ -56,8 +56,8 @@ describe('Redoc components', () => { }); /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [MethodsList], providers: [SchemaManager], template: diff --git a/lib/components/Redoc/redoc.spec.js b/lib/components/Redoc/redoc.spec.js index d271bcd4..fd7b1462 100644 --- a/lib/components/Redoc/redoc.spec.js +++ b/lib/components/Redoc/redoc.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement } from 'tests/helpers'; -import {Component, View, ViewMetadata, provide} from 'angular2/core'; +import {Component, ViewMetadata, provide} from 'angular2/core'; import {BrowserDomAdapter} from 'angular2/platform/browser'; import { @@ -224,8 +224,8 @@ describe('Redoc components', () => { }); /** Test component that contains a Redoc. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [Redoc], template: `` diff --git a/lib/components/SideMenu/side-menu.spec.js b/lib/components/SideMenu/side-menu.spec.js index 0e5ce1ad..0ebcb414 100644 --- a/lib/components/SideMenu/side-menu.spec.js +++ b/lib/components/SideMenu/side-menu.spec.js @@ -1,7 +1,7 @@ 'use strict'; import { getChildDebugElement, mouseclick} from 'tests/helpers'; -import {Component, View, provide, ViewMetadata} from 'angular2/core'; +import {Component, provide, ViewMetadata} from 'angular2/core'; import {BrowserDomAdapter} from 'angular2/platform/browser'; import OptionsManager from 'lib/options'; @@ -196,8 +196,8 @@ describe('Redoc components', () => { }); /** Test component that contains an ApiInfo. */ -@Component({selector: 'test-app'}) -@View({ +@Component({ + selector: 'test-app', directives: [MethodsList, SideMenu], providers: [SchemaManager], template: diff --git a/lib/components/base.js b/lib/components/base.js index d8582e5e..fd5a0ef4 100644 --- a/lib/components/base.js +++ b/lib/components/base.js @@ -1,5 +1,5 @@ 'use strict'; -import {Component, View, OnInit, OnDestroy, ChangeDetectionStrategy} from 'angular2/core'; +import {Component, ChangeDetectionStrategy} from 'angular2/core'; import {CORE_DIRECTIVES, JsonPipe, AsyncPipe} from 'angular2/common'; import SchemaManager from '../utils/SchemaManager'; import JsonPointer from '../utils/JsonPointer'; @@ -74,11 +74,8 @@ export function RedocComponent(options) { selector: options.selector, inputs: inputs, outputs: options.outputs, - lifecycle: [OnInit, OnDestroy], providers: options.providers, - changeDetection: options.changeDetection || ChangeDetectionStrategy.Detached - }); - let viewDecorator = View({ + changeDetection: options.changeDetection || ChangeDetectionStrategy.Detached, templateUrl: options.templateUrl, template: options.template, styles: options.styles, @@ -86,7 +83,7 @@ export function RedocComponent(options) { pipes: pipes }); - return componentDecorator(viewDecorator(target) || target) || target; + return componentDecorator(target) || target; }; } diff --git a/lib/utils/SchemaManager.js b/lib/utils/SchemaManager.js index 2c11af6a..b3f9dca4 100644 --- a/lib/utils/SchemaManager.js +++ b/lib/utils/SchemaManager.js @@ -38,6 +38,7 @@ export default class SchemaManager { /* calculate common used values */ init() { + if (!this._schema || !this._schema.schemes) return; this.apiUrl = this._schema.schemes[0] + '://' + this._schema.host + this._schema.basePath; if (this.apiUrl.endsWith('/')) { this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1); diff --git a/lib/utils/pipes.js b/lib/utils/pipes.js index 6d9a1ed6..19d5ef7a 100644 --- a/lib/utils/pipes.js +++ b/lib/utils/pipes.js @@ -14,19 +14,17 @@ import 'prismjs/components/prism-php.js'; import 'prismjs/components/prism-coffeescript.js'; import 'prismjs/components/prism-go.js'; import 'prismjs/components/prism-haskell.js'; -//import 'prismjs/components/prism-scala.js'; import 'prismjs/components/prism-java.js'; import 'prismjs/components/prism-lua.js'; import 'prismjs/components/prism-matlab.js'; -import 'prismjs/components/prism-objectivec.js'; import 'prismjs/components/prism-perl.js'; import 'prismjs/components/prism-python.js'; import 'prismjs/components/prism-r.js'; import 'prismjs/components/prism-ruby.js'; import 'prismjs/components/prism-bash.js'; import 'prismjs/components/prism-swift.js'; -import 'prismjs/components/prism-vim.js'; - +import 'prismjs/components/prism-objectivec.js'; +import 'prismjs/components/prism-scala.js'; import 'prismjs/themes/prism-dark.css!css'; import marked from 'marked'; diff --git a/package.json b/package.json index 7800588d..264ff017 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "jspm": { "configFile": "system.config.js", "dependencies": { - "angular2": "npm:angular2@2.0.0-beta.6", + "angular2": "npm:angular2@^2.0.0-beta.12", "es6-shim": "github:es-shims/es6-shim@^0.33.6", "json": "github:systemjs/plugin-json@^0.1.0", "json-formatter-js": "npm:json-formatter-js@^0.2.0", @@ -96,6 +96,6 @@ "sinon": "^1.17.2", "systemjs-builder": "^0.15.2", "vinyl-paths": "^2.0.0", - "zone.js": "^0.5.10" + "zone.js": "^0.6.6" } } diff --git a/system.config.js b/system.config.js index c5896f10..aee76847 100644 --- a/system.config.js +++ b/system.config.js @@ -37,7 +37,7 @@ System.config({ }, map: { - "angular2": "npm:angular2@2.0.0-beta.6", + "angular2": "npm:angular2@2.0.0-beta.12", "babel": "npm:babel-core@5.8.34", "babel-runtime": "npm:babel-runtime@5.8.34", "clean-css": "npm:clean-css@3.4.6", @@ -135,14 +135,10 @@ System.config({ "path": "github:jspm/nodelibs-path@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:angular2@2.0.0-beta.6": { - "crypto": "github:jspm/nodelibs-crypto@0.1.0", - "es6-promise": "npm:es6-promise@3.1.2", - "es6-shim": "npm:es6-shim@0.33.13", - "process": "github:jspm/nodelibs-process@0.1.2", - "reflect-metadata": "npm:reflect-metadata@0.1.2", - "rxjs": "npm:rxjs@5.0.0-beta.0", - "zone.js": "npm:zone.js@0.5.14" + "npm:angular2@2.0.0-beta.12": { + "reflect-metadata": "npm:reflect-metadata@0.1.3", + "rxjs": "npm:rxjs@5.0.0-beta.3", + "zone.js": "npm:zone.js@0.5.15" }, "npm:argparse@1.0.3": { "assert": "github:jspm/nodelibs-assert@0.1.0", @@ -419,9 +415,6 @@ System.config({ "npm:es6-promise@3.1.2": { "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:es6-shim@0.33.13": { - "process": "github:jspm/nodelibs-process@0.1.2" - }, "npm:esprima@2.7.1": { "fs": "github:jspm/nodelibs-fs@0.1.2", "process": "github:jspm/nodelibs-process@0.1.2" @@ -691,10 +684,6 @@ System.config({ "string_decoder": "npm:string_decoder@0.10.31", "util-deprecate": "npm:util-deprecate@1.0.2" }, - "npm:reflect-metadata@0.1.2": { - "assert": "github:jspm/nodelibs-assert@0.1.0", - "process": "github:jspm/nodelibs-process@0.1.2" - }, "npm:request@2.67.0": { "aws-sign2": "npm:aws-sign2@0.6.0", "bl": "npm:bl@1.0.0", @@ -732,7 +721,7 @@ System.config({ "buffer": "github:jspm/nodelibs-buffer@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, - "npm:rxjs@5.0.0-beta.0": { + "npm:rxjs@5.0.0-beta.3": { "buffer": "github:jspm/nodelibs-buffer@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2" }, @@ -865,10 +854,6 @@ System.config({ "request": "npm:request@2.67.0", "systemjs-json": "github:systemjs/plugin-json@0.1.0", "validator": "npm:validator@4.5.0" - }, - "npm:zone.js@0.5.14": { - "es6-promise": "npm:es6-promise@3.1.2", - "process": "github:jspm/nodelibs-process@0.1.2" } } }); From a23008e839d2d918d46445516071a47f55f90d7f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 27 Mar 2016 19:06:00 +0300 Subject: [PATCH 3/7] Update dev dependencies --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 264ff017..c145abe9 100644 --- a/package.json +++ b/package.json @@ -60,10 +60,10 @@ "browser-sync": "^2.10.1", "del": "^2.2.0", "deploy-to-gh-pages": "^1.0.0", - "gulp": "^3.9.0", + "gulp": "^3.9.1", "gulp-concat": "^2.6.0", "gulp-eslint": "^1.1.1", - "gulp-inline-ng2-template": "^0.0.9", + "gulp-inline-ng2-template": "^1.1.2", "gulp-protractor": "^2.1.0", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.4", @@ -81,13 +81,13 @@ "karma-coveralls": "^1.1.2", "karma-jasmine": "^0.3.6", "karma-jspm": "^2.0.2", - "karma-mocha-reporter": "^1.1.3", - "karma-phantomjs-launcher": "^0.2.1", + "karma-mocha-reporter": "^2.0.0", + "karma-phantomjs-launcher": "^1.0.0", "karma-phantomjs-shim": "^1.1.2", "karma-regex-preprocessor": "github:makern/karma-regex-preprocessor", "karma-should": "^1.0.0", "karma-sinon": "^1.0.4", - "phantomjs": "^1.9.19", + "phantomjs-prebuilt": "^2.1.7", "protractor": "^3.0.0", "reflect-metadata": "^0.1.2", "require-dir": "^0.3.0", From b6a711b25d58a2c4052a552b0499646b4aaa376f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 27 Mar 2016 20:17:28 +0300 Subject: [PATCH 4/7] Fix change-detection on Safari/IE --- lib/components/JsonSchema/json-schema-lazy.js | 2 +- lib/components/SideMenu/side-menu.js | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/components/JsonSchema/json-schema-lazy.js b/lib/components/JsonSchema/json-schema-lazy.js index 58922db7..8992cda9 100644 --- a/lib/components/JsonSchema/json-schema-lazy.js +++ b/lib/components/JsonSchema/json-schema-lazy.js @@ -40,7 +40,7 @@ export default class JsonSchemaLazy { this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => { compRef.instance.pointer = this.pointer; // trigger change detection - compRef.location.internalElement.parentView.changeDetector.detectChanges(); + compRef.hostView.changeDetectorRef.detectChanges(); }); } this.loaded = true; diff --git a/lib/components/SideMenu/side-menu.js b/lib/components/SideMenu/side-menu.js index 1637749b..d0d63042 100644 --- a/lib/components/SideMenu/side-menu.js +++ b/lib/components/SideMenu/side-menu.js @@ -1,6 +1,6 @@ 'use strict'; -import {NgZone, ChangeDetectionStrategy, ElementRef} from 'angular2/core'; +import {ChangeDetectorRef, ChangeDetectionStrategy, ElementRef} from 'angular2/core'; import {document} from 'angular2/src/facade/browser'; import {BrowserDomAdapter} from 'angular2/platform/browser'; import {global} from 'angular2/src/facade/lang'; @@ -28,19 +28,16 @@ const INVIEW_POSITION = { changeDetection: ChangeDetectionStrategy.Default }) @Reflect.metadata('parameters', [[SchemaManager], [ElementRef], - [BrowserDomAdapter], [NgZone], OptionsManager]) + [BrowserDomAdapter], [ChangeDetectorRef], [OptionsManager]]) export default class SideMenu extends BaseComponent { - constructor(schemaMgr, elementRef, dom, zone, optionsMgr) { + constructor(schemaMgr, elementRef, dom, changeDetectorRef, optionsMgr) { super(schemaMgr); this.$element = elementRef.nativeElement; + this.changeDetector = changeDetectorRef; this.dom = dom; this.options = optionsMgr.options; this.$scrollParent = this.options.$scrollParent; - // for some reason constructor is not run inside zone - // as workaround running it manually - zone.run(() => { - this.bindEvents(); - }); + this.bindEvents(); this.activeCatIdx = 0; this.activeMethodIdx = -1; this.prevOffsetY = null; @@ -221,6 +218,7 @@ export default class SideMenu extends BaseComponent { } stable = true; } + this.changeDetector.detectChanges(); } prepareModel() { From ae0ce4ac52b84b2c1a378ddcbc543b71255ef795 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 27 Mar 2016 20:31:07 +0300 Subject: [PATCH 5/7] fix test --- lib/components/JsonSchema/json-schema-lazy.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/JsonSchema/json-schema-lazy.spec.js b/lib/components/JsonSchema/json-schema-lazy.spec.js index c8d10a5d..debc622c 100644 --- a/lib/components/JsonSchema/json-schema-lazy.spec.js +++ b/lib/components/JsonSchema/json-schema-lazy.spec.js @@ -26,7 +26,7 @@ describe('Redoc components', () => { let loader; let appRef = { instance: {}, - location: {internalElement: {parentView: {changeDetector: {detectChanges : function() {} }}}} + hostView: {changeDetectorRef: {detectChanges : function() {} }} }; beforeEachProviders(() => [ provide(SchemaManager, {useValue: schemaMgr}), From 6004fb013205e9542215dc0803506c458ea94396 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 28 Mar 2016 00:54:43 +0300 Subject: [PATCH 6/7] Add help messages for different types of parameters (fixes #26) --- lib/components/ParamsList/params-list.html | 5 +++- lib/components/ParamsList/params-list.js | 13 +++++++++- lib/components/ParamsList/params-list.scss | 28 ++++++++++++++++++++++ lib/utils/pipes.js | 2 ++ package.json | 1 + system.config.js | 1 + 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/lib/components/ParamsList/params-list.html b/lib/components/ParamsList/params-list.html index 64c9e80b..faaf4a55 100644 --- a/lib/components/ParamsList/params-list.html +++ b/lib/components/ParamsList/params-list.html @@ -1,6 +1,9 @@
    Parameters