mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-24 17:43:45 +03:00
Merge branch 'master' into releases
This commit is contained in:
commit
3bcedb9ad8
|
@ -43,14 +43,14 @@ gulp.task('inlineTemplates', ['sass'], function() {
|
||||||
|
|
||||||
var JS_DEV_DEPS = [
|
var JS_DEV_DEPS = [
|
||||||
'lib/utils/browser-update.js',
|
'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/reflect-metadata/Reflect.js',
|
||||||
'node_modules/babel-polyfill/dist/polyfill.js'
|
'node_modules/babel-polyfill/dist/polyfill.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
var JS_DEV_DEPS_MIN = [
|
var JS_DEV_DEPS_MIN = [
|
||||||
'lib/utils/browser-update.js',
|
'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/reflect-metadata/Reflect.js',
|
||||||
'node_modules/babel-polyfill/dist/polyfill.min.js'
|
'node_modules/babel-polyfill/dist/polyfill.min.js'
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,9 +45,9 @@ module.exports = function (config) {
|
||||||
},
|
},
|
||||||
//load angular dependencies and browser polyfills
|
//load angular dependencies and browser polyfills
|
||||||
files: [
|
files: [
|
||||||
'node_modules/zone.js/dist/zone-microtask.js',
|
'node_modules/zone.js/dist/zone.js',
|
||||||
'node_modules/zone.js/dist/long-stack-trace-zone.js',
|
|
||||||
'node_modules/zone.js/dist/jasmine-patch.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/babel-polyfill/dist/polyfill.js',
|
||||||
'./node_modules/reflect-metadata/Reflect.js'
|
'./node_modules/reflect-metadata/Reflect.js'
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElementByType } from 'tests/helpers';
|
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 {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -60,8 +60,8 @@ describe('Common components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [StickySidebar],
|
directives: [StickySidebar],
|
||||||
template:
|
template:
|
||||||
`<div style="padding-top: 20px">
|
`<div style="padding-top: 20px">
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {Component, View, EventEmitter} from 'angular2/core';
|
import {Component, EventEmitter} from 'angular2/core';
|
||||||
import {CORE_DIRECTIVES} from 'angular2/common';
|
import {CORE_DIRECTIVES} from 'angular2/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tabs',
|
selector: 'tabs',
|
||||||
events: ['change']
|
events: ['change'],
|
||||||
})
|
|
||||||
@View({
|
|
||||||
template: `
|
template: `
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="#tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
|
<li *ngFor="#tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
|
||||||
|
@ -61,9 +59,7 @@ export class Tabs {
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tab',
|
selector: 'tab',
|
||||||
inputs: ['tabTitle', 'tabStatus']
|
inputs: ['tabTitle', 'tabStatus'],
|
||||||
})
|
|
||||||
@View({
|
|
||||||
template: `
|
template: `
|
||||||
<div class="tab-wrap" [ngClass]="{ 'active': active }">
|
<div class="tab-wrap" [ngClass]="{ 'active': active }">
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement, getChildDebugElementAll } from 'tests/helpers';
|
import { getChildDebugElement, getChildDebugElementAll } from 'tests/helpers';
|
||||||
import {Component, View} from 'angular2/core';
|
import {Component} from 'angular2/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TestComponentBuilder,
|
TestComponentBuilder,
|
||||||
|
@ -137,8 +137,8 @@ describe('Common components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [Tabs, Tab],
|
directives: [Tabs, Tab],
|
||||||
template:
|
template:
|
||||||
`<tabs (change)="onEvent($event)">
|
`<tabs (change)="onEvent($event)">
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {Component, View, EventEmitter} from 'angular2/core';
|
import {Component, EventEmitter} from 'angular2/core';
|
||||||
import {CORE_DIRECTIVES} from 'angular2/common';
|
import {CORE_DIRECTIVES} from 'angular2/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'zippy',
|
selector: 'zippy',
|
||||||
events: ['open', 'close'],
|
events: ['open', 'close'],
|
||||||
inputs: ['title', 'visible', 'type', 'empty']
|
inputs: ['title', 'visible', 'type', 'empty'],
|
||||||
})
|
|
||||||
@View({
|
|
||||||
templateUrl: './lib/common/components/Zippy/zippy.html',
|
templateUrl: './lib/common/components/Zippy/zippy.html',
|
||||||
styleUrls: ['./lib/common/components/Zippy/zippy.css'],
|
styleUrls: ['./lib/common/components/Zippy/zippy.css'],
|
||||||
directives: [CORE_DIRECTIVES]
|
directives: [CORE_DIRECTIVES]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement, mouseclick } from 'tests/helpers';
|
import { getChildDebugElement, mouseclick } from 'tests/helpers';
|
||||||
import {Component, View} from 'angular2/core';
|
import {Component} from 'angular2/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TestComponentBuilder,
|
TestComponentBuilder,
|
||||||
|
@ -94,8 +94,8 @@ describe('Common components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [Zippy],
|
directives: [Zippy],
|
||||||
template:
|
template:
|
||||||
`<zippy title="Zippy" type="test" visible="true" empty="true" (open)="open()" (close)="close()">test</zippy>`
|
`<zippy title="Zippy" type="test" visible="true" empty="true" (open)="open()" (close)="close()">test</zippy>`
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
import {Component, View, provide} from 'angular2/core';
|
import {Component, provide} from 'angular2/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TestComponentBuilder,
|
TestComponentBuilder,
|
||||||
|
@ -53,8 +53,8 @@ describe('Redoc components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [ApiInfo],
|
directives: [ApiInfo],
|
||||||
template:
|
template:
|
||||||
`<api-info></api-info>`
|
`<api-info></api-info>`
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
import {Component, View, provide} from 'angular2/core';
|
import {Component, provide} from 'angular2/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TestComponentBuilder,
|
TestComponentBuilder,
|
||||||
|
@ -65,8 +65,8 @@ describe('Redoc components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [ApiLogo],
|
directives: [ApiLogo],
|
||||||
providers: [SchemaManager],
|
providers: [SchemaManager],
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {Component, View, ElementRef} from 'angular2/core';
|
import {Component, ElementRef} from 'angular2/core';
|
||||||
import {CORE_DIRECTIVES} from 'angular2/common';
|
import {CORE_DIRECTIVES} from 'angular2/common';
|
||||||
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||||
|
|
||||||
|
@ -14,9 +14,7 @@ var cache = {};
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'json-schema-lazy',
|
selector: 'json-schema-lazy',
|
||||||
inputs: ['pointer', 'auto']
|
inputs: ['pointer', 'auto'],
|
||||||
})
|
|
||||||
@View({
|
|
||||||
template: '',
|
template: '',
|
||||||
directives: [CORE_DIRECTIVES]
|
directives: [CORE_DIRECTIVES]
|
||||||
})
|
})
|
||||||
|
@ -41,6 +39,8 @@ export default class JsonSchemaLazy {
|
||||||
if (this.pointer) {
|
if (this.pointer) {
|
||||||
this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
|
this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
|
||||||
compRef.instance.pointer = this.pointer;
|
compRef.instance.pointer = this.pointer;
|
||||||
|
// trigger change detection
|
||||||
|
compRef.hostView.changeDetectorRef.detectChanges();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
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 {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||||
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ describe('Redoc components', () => {
|
||||||
let fixture;
|
let fixture;
|
||||||
let loader;
|
let loader;
|
||||||
let appRef = {
|
let appRef = {
|
||||||
instance: {}
|
instance: {},
|
||||||
|
hostView: {changeDetectorRef: {detectChanges : function() {} }}
|
||||||
};
|
};
|
||||||
beforeEachProviders(() => [
|
beforeEachProviders(() => [
|
||||||
provide(SchemaManager, {useValue: schemaMgr}),
|
provide(SchemaManager, {useValue: schemaMgr}),
|
||||||
|
@ -80,8 +81,8 @@ describe('Redoc components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains a Method. */
|
/** Test component that contains a Method. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [JsonSchemaLazy],
|
directives: [JsonSchemaLazy],
|
||||||
template:
|
template:
|
||||||
`<json-schema-lazy></json-schema-lazy>`
|
`<json-schema-lazy></json-schema-lazy>`
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
import {Component, View, provide} from 'angular2/core';
|
import {Component, provide} from 'angular2/core';
|
||||||
import OptionsManager from 'lib/options';
|
import OptionsManager from 'lib/options';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -64,8 +64,8 @@ describe('Redoc components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains a Method. */
|
/** Test component that contains a Method. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [JsonSchema],
|
directives: [JsonSchema],
|
||||||
providers: [SchemaManager],
|
providers: [SchemaManager],
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
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 {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -57,8 +57,8 @@ describe('Redoc components', () => {
|
||||||
|
|
||||||
|
|
||||||
/** Test component that contains a Method. */
|
/** Test component that contains a Method. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [Method],
|
directives: [Method],
|
||||||
providers: [SchemaManager],
|
providers: [SchemaManager],
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
import { getChildDebugElement } from 'tests/helpers';
|
||||||
import {Component, View, provide} from 'angular2/core';
|
import {Component, provide} from 'angular2/core';
|
||||||
import OptionsManager from 'lib/options';
|
import OptionsManager from 'lib/options';
|
||||||
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ describe('Redoc components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [MethodsList],
|
directives: [MethodsList],
|
||||||
providers: [SchemaManager],
|
providers: [SchemaManager],
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<h5 class="param-list-header" *ngIf="data.params.length"> Parameters </h5>
|
<h5 class="param-list-header" *ngIf="data.params.length"> Parameters </h5>
|
||||||
<template ngFor [ngForOf]="data.params" #paramType="$implicit">
|
<template ngFor [ngForOf]="data.params" #paramType="$implicit">
|
||||||
<header class="paramType"> {{paramType.place}} Parameters </header>
|
<header class="paramType">
|
||||||
|
{{paramType.place}} Parameters
|
||||||
|
<span class="hint--top-right hint--large" [attr.data-hint]="paramType.placeHint">?</span>
|
||||||
|
</header>
|
||||||
<br>
|
<br>
|
||||||
<div class="params-wrap">
|
<div class="params-wrap">
|
||||||
<div *ngFor="#param of paramType.params" class="param">
|
<div *ngFor="#param of paramType.params" class="param">
|
||||||
|
|
|
@ -42,10 +42,21 @@ export default class ParamsList extends BaseComponent {
|
||||||
this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);
|
this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);
|
||||||
|
|
||||||
let paramsPlaces = ['path', 'query', 'formData', 'header', 'body'];
|
let paramsPlaces = ['path', 'query', 'formData', 'header', 'body'];
|
||||||
|
let placeHint = {
|
||||||
|
path: `Used together with Path Templating, where the parameter value is actually part
|
||||||
|
of the operation's URL. This does not include the host or base path of the API.
|
||||||
|
For example, in /items/{itemId}, the path parameter is itemId`,
|
||||||
|
query: `Parameters that are appended to the URL.
|
||||||
|
For example, in /items?id=###, the query parameter is id`,
|
||||||
|
formData: `Parameters that are submitted through a form.
|
||||||
|
application/x-www-form-urlencoded, multipart/form-data or both are usually
|
||||||
|
used as the content type of the request`,
|
||||||
|
header: 'Custom headers that are expected as part of the request'
|
||||||
|
};
|
||||||
let params = [];
|
let params = [];
|
||||||
paramsPlaces.forEach(place => {
|
paramsPlaces.forEach(place => {
|
||||||
if (paramsMap[place] && paramsMap[place].length) {
|
if (paramsMap[place] && paramsMap[place].length) {
|
||||||
params.push({place: place, params: paramsMap[place]});
|
params.push({place: place, placeHint: placeHint[place], params: paramsMap[place]});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.data.params = params;
|
this.data.params = params;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
@import '../../common/styles/variables';
|
@import '../../common/styles/variables';
|
||||||
|
|
||||||
|
$hint-color: #999999;
|
||||||
|
|
||||||
.param-list-header {
|
.param-list-header {
|
||||||
border-bottom: 1px solid rgba($text-color, .3);
|
border-bottom: 1px solid rgba($text-color, .3);
|
||||||
padding: 0.2em 0;
|
padding: 0.2em 0;
|
||||||
|
@ -60,3 +62,29 @@ header.paramType {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-hint] {
|
||||||
|
width: 1.2em;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
vertical-align: middle;
|
||||||
|
color: $hint-color;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-transform: none;
|
||||||
|
cursor: help;
|
||||||
|
border: 1px solid $hint-color;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 520px) {
|
||||||
|
[data-hint] {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-hint]:after {
|
||||||
|
margin-left: 12px;
|
||||||
|
transform: translateX(-100%) translateY(-8px);
|
||||||
|
-moz-transform: translateX(-100%) translateY(-8px);
|
||||||
|
-webkit-transform: translateX(-100%) translateY(-8px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement } from 'tests/helpers';
|
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 {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -224,8 +224,8 @@ describe('Redoc components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Test component that contains a Redoc. */
|
/** Test component that contains a Redoc. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [Redoc],
|
directives: [Redoc],
|
||||||
template:
|
template:
|
||||||
`<redoc disable-lazy-schemas></redoc>`
|
`<redoc disable-lazy-schemas></redoc>`
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {NgZone, ChangeDetectionStrategy, ElementRef} from 'angular2/core';
|
import {ChangeDetectorRef, ChangeDetectionStrategy, ElementRef} from 'angular2/core';
|
||||||
import {document} from 'angular2/src/facade/browser';
|
import {document} from 'angular2/src/facade/browser';
|
||||||
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
import {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
import {global} from 'angular2/src/facade/lang';
|
import {global} from 'angular2/src/facade/lang';
|
||||||
|
@ -28,19 +28,16 @@ const INVIEW_POSITION = {
|
||||||
changeDetection: ChangeDetectionStrategy.Default
|
changeDetection: ChangeDetectionStrategy.Default
|
||||||
})
|
})
|
||||||
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef],
|
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef],
|
||||||
[BrowserDomAdapter], [NgZone], OptionsManager])
|
[BrowserDomAdapter], [ChangeDetectorRef], [OptionsManager]])
|
||||||
export default class SideMenu extends BaseComponent {
|
export default class SideMenu extends BaseComponent {
|
||||||
constructor(schemaMgr, elementRef, dom, zone, optionsMgr) {
|
constructor(schemaMgr, elementRef, dom, changeDetectorRef, optionsMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
this.$element = elementRef.nativeElement;
|
this.$element = elementRef.nativeElement;
|
||||||
|
this.changeDetector = changeDetectorRef;
|
||||||
this.dom = dom;
|
this.dom = dom;
|
||||||
this.options = optionsMgr.options;
|
this.options = optionsMgr.options;
|
||||||
this.$scrollParent = this.options.$scrollParent;
|
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.activeCatIdx = 0;
|
||||||
this.activeMethodIdx = -1;
|
this.activeMethodIdx = -1;
|
||||||
this.prevOffsetY = null;
|
this.prevOffsetY = null;
|
||||||
|
@ -221,6 +218,7 @@ export default class SideMenu extends BaseComponent {
|
||||||
}
|
}
|
||||||
stable = true;
|
stable = true;
|
||||||
}
|
}
|
||||||
|
this.changeDetector.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareModel() {
|
prepareModel() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { getChildDebugElement, mouseclick} from 'tests/helpers';
|
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 {BrowserDomAdapter} from 'angular2/platform/browser';
|
||||||
import OptionsManager from 'lib/options';
|
import OptionsManager from 'lib/options';
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ describe('Redoc components', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Test component that contains an ApiInfo. */
|
/** Test component that contains an ApiInfo. */
|
||||||
@Component({selector: 'test-app'})
|
@Component({
|
||||||
@View({
|
selector: 'test-app',
|
||||||
directives: [MethodsList, SideMenu],
|
directives: [MethodsList, SideMenu],
|
||||||
providers: [SchemaManager],
|
providers: [SchemaManager],
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
'use strict';
|
'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 {CORE_DIRECTIVES, JsonPipe, AsyncPipe} from 'angular2/common';
|
||||||
import SchemaManager from '../utils/SchemaManager';
|
import SchemaManager from '../utils/SchemaManager';
|
||||||
import JsonPointer from '../utils/JsonPointer';
|
import JsonPointer from '../utils/JsonPointer';
|
||||||
|
@ -74,11 +74,8 @@ export function RedocComponent(options) {
|
||||||
selector: options.selector,
|
selector: options.selector,
|
||||||
inputs: inputs,
|
inputs: inputs,
|
||||||
outputs: options.outputs,
|
outputs: options.outputs,
|
||||||
lifecycle: [OnInit, OnDestroy],
|
|
||||||
providers: options.providers,
|
providers: options.providers,
|
||||||
changeDetection: options.changeDetection || ChangeDetectionStrategy.Detached
|
changeDetection: options.changeDetection || ChangeDetectionStrategy.Detached,
|
||||||
});
|
|
||||||
let viewDecorator = View({
|
|
||||||
templateUrl: options.templateUrl,
|
templateUrl: options.templateUrl,
|
||||||
template: options.template,
|
template: options.template,
|
||||||
styles: options.styles,
|
styles: options.styles,
|
||||||
|
@ -86,7 +83,7 @@ export function RedocComponent(options) {
|
||||||
pipes: pipes
|
pipes: pipes
|
||||||
});
|
});
|
||||||
|
|
||||||
return componentDecorator(viewDecorator(target) || target) || target;
|
return componentDecorator(target) || target;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,13 +182,13 @@ export class BaseComponent {
|
||||||
throw new Error(errMessage);
|
throw new Error(errMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
into.type = into.type || subSchema.type;
|
|
||||||
|
|
||||||
if (into.type === 'array') {
|
if (into.type === 'array') {
|
||||||
console.warn('allOf: subschemas with type array are not supported yet');
|
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)
|
// 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) {
|
if (into.type === 'object' && subSchema.properties) {
|
||||||
into.properties || (into.properties = {});
|
into.properties || (into.properties = {});
|
||||||
Object.assign(into.properties, subSchema.properties);
|
Object.assign(into.properties, subSchema.properties);
|
||||||
|
|
|
@ -38,6 +38,7 @@ export default class SchemaManager {
|
||||||
|
|
||||||
/* calculate common used values */
|
/* calculate common used values */
|
||||||
init() {
|
init() {
|
||||||
|
if (!this._schema || !this._schema.schemes) return;
|
||||||
this.apiUrl = this._schema.schemes[0] + '://' + this._schema.host + this._schema.basePath;
|
this.apiUrl = this._schema.schemes[0] + '://' + this._schema.host + this._schema.basePath;
|
||||||
if (this.apiUrl.endsWith('/')) {
|
if (this.apiUrl.endsWith('/')) {
|
||||||
this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1);
|
this.apiUrl = this.apiUrl.substr(0, this.apiUrl.length - 1);
|
||||||
|
|
|
@ -14,20 +14,20 @@ import 'prismjs/components/prism-php.js';
|
||||||
import 'prismjs/components/prism-coffeescript.js';
|
import 'prismjs/components/prism-coffeescript.js';
|
||||||
import 'prismjs/components/prism-go.js';
|
import 'prismjs/components/prism-go.js';
|
||||||
import 'prismjs/components/prism-haskell.js';
|
import 'prismjs/components/prism-haskell.js';
|
||||||
//import 'prismjs/components/prism-scala.js';
|
|
||||||
import 'prismjs/components/prism-java.js';
|
import 'prismjs/components/prism-java.js';
|
||||||
import 'prismjs/components/prism-lua.js';
|
import 'prismjs/components/prism-lua.js';
|
||||||
import 'prismjs/components/prism-matlab.js';
|
import 'prismjs/components/prism-matlab.js';
|
||||||
import 'prismjs/components/prism-objectivec.js';
|
|
||||||
import 'prismjs/components/prism-perl.js';
|
import 'prismjs/components/prism-perl.js';
|
||||||
import 'prismjs/components/prism-python.js';
|
import 'prismjs/components/prism-python.js';
|
||||||
import 'prismjs/components/prism-r.js';
|
import 'prismjs/components/prism-r.js';
|
||||||
import 'prismjs/components/prism-ruby.js';
|
import 'prismjs/components/prism-ruby.js';
|
||||||
import 'prismjs/components/prism-bash.js';
|
import 'prismjs/components/prism-bash.js';
|
||||||
import 'prismjs/components/prism-swift.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 'prismjs/themes/prism-dark.css!css';
|
||||||
|
import 'hint.css/hint.base.css!css';
|
||||||
|
|
||||||
import marked from 'marked';
|
import marked from 'marked';
|
||||||
|
|
||||||
|
|
17
package.json
17
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "redoc",
|
"name": "redoc",
|
||||||
"description": "Swagger-generated API Reference Documentation",
|
"description": "Swagger-generated API Reference Documentation",
|
||||||
"version": "0.7.8",
|
"version": "0.7.9",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/Rebilly/ReDoc"
|
"url": "git://github.com/Rebilly/ReDoc"
|
||||||
|
@ -32,8 +32,9 @@
|
||||||
"jspm": {
|
"jspm": {
|
||||||
"configFile": "system.config.js",
|
"configFile": "system.config.js",
|
||||||
"dependencies": {
|
"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",
|
"es6-shim": "github:es-shims/es6-shim@^0.33.6",
|
||||||
|
"hint.css": "npm:hint.css@^2.2.1",
|
||||||
"json": "github:systemjs/plugin-json@^0.1.0",
|
"json": "github:systemjs/plugin-json@^0.1.0",
|
||||||
"json-formatter-js": "npm:json-formatter-js@^0.2.0",
|
"json-formatter-js": "npm:json-formatter-js@^0.2.0",
|
||||||
"json-pointer": "npm:json-pointer@^0.3.0",
|
"json-pointer": "npm:json-pointer@^0.3.0",
|
||||||
|
@ -60,10 +61,10 @@
|
||||||
"browser-sync": "^2.10.1",
|
"browser-sync": "^2.10.1",
|
||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"deploy-to-gh-pages": "^1.0.0",
|
"deploy-to-gh-pages": "^1.0.0",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.1",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-eslint": "^1.1.1",
|
"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-protractor": "^2.1.0",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
|
@ -81,13 +82,13 @@
|
||||||
"karma-coveralls": "^1.1.2",
|
"karma-coveralls": "^1.1.2",
|
||||||
"karma-jasmine": "^0.3.6",
|
"karma-jasmine": "^0.3.6",
|
||||||
"karma-jspm": "^2.0.2",
|
"karma-jspm": "^2.0.2",
|
||||||
"karma-mocha-reporter": "^1.1.3",
|
"karma-mocha-reporter": "^2.0.0",
|
||||||
"karma-phantomjs-launcher": "^0.2.1",
|
"karma-phantomjs-launcher": "^1.0.0",
|
||||||
"karma-phantomjs-shim": "^1.1.2",
|
"karma-phantomjs-shim": "^1.1.2",
|
||||||
"karma-regex-preprocessor": "github:makern/karma-regex-preprocessor",
|
"karma-regex-preprocessor": "github:makern/karma-regex-preprocessor",
|
||||||
"karma-should": "^1.0.0",
|
"karma-should": "^1.0.0",
|
||||||
"karma-sinon": "^1.0.4",
|
"karma-sinon": "^1.0.4",
|
||||||
"phantomjs": "^1.9.19",
|
"phantomjs-prebuilt": "^2.1.7",
|
||||||
"protractor": "^3.0.0",
|
"protractor": "^3.0.0",
|
||||||
"reflect-metadata": "^0.1.2",
|
"reflect-metadata": "^0.1.2",
|
||||||
"require-dir": "^0.3.0",
|
"require-dir": "^0.3.0",
|
||||||
|
@ -96,6 +97,6 @@
|
||||||
"sinon": "^1.17.2",
|
"sinon": "^1.17.2",
|
||||||
"systemjs-builder": "^0.15.2",
|
"systemjs-builder": "^0.15.2",
|
||||||
"vinyl-paths": "^2.0.0",
|
"vinyl-paths": "^2.0.0",
|
||||||
"zone.js": "^0.5.10"
|
"zone.js": "^0.6.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,14 @@ System.config({
|
||||||
},
|
},
|
||||||
|
|
||||||
map: {
|
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": "npm:babel-core@5.8.34",
|
||||||
"babel-runtime": "npm:babel-runtime@5.8.34",
|
"babel-runtime": "npm:babel-runtime@5.8.34",
|
||||||
"clean-css": "npm:clean-css@3.4.6",
|
"clean-css": "npm:clean-css@3.4.6",
|
||||||
"core-js": "npm:core-js@1.2.6",
|
"core-js": "npm:core-js@1.2.6",
|
||||||
"css": "github:systemjs/plugin-css@0.1.18",
|
"css": "github:systemjs/plugin-css@0.1.18",
|
||||||
"es6-shim": "github:es-shims/es6-shim@0.33.6",
|
"es6-shim": "github:es-shims/es6-shim@0.33.6",
|
||||||
|
"hint.css": "npm:hint.css@2.2.1",
|
||||||
"json": "github:systemjs/plugin-json@0.1.0",
|
"json": "github:systemjs/plugin-json@0.1.0",
|
||||||
"json-formatter-js": "npm:json-formatter-js@0.2.0",
|
"json-formatter-js": "npm:json-formatter-js@0.2.0",
|
||||||
"json-pointer": "npm:json-pointer@0.3.0",
|
"json-pointer": "npm:json-pointer@0.3.0",
|
||||||
|
@ -135,14 +136,10 @@ System.config({
|
||||||
"path": "github:jspm/nodelibs-path@0.1.0",
|
"path": "github:jspm/nodelibs-path@0.1.0",
|
||||||
"process": "github:jspm/nodelibs-process@0.1.2"
|
"process": "github:jspm/nodelibs-process@0.1.2"
|
||||||
},
|
},
|
||||||
"npm:angular2@2.0.0-beta.6": {
|
"npm:angular2@2.0.0-beta.12": {
|
||||||
"crypto": "github:jspm/nodelibs-crypto@0.1.0",
|
"reflect-metadata": "npm:reflect-metadata@0.1.3",
|
||||||
"es6-promise": "npm:es6-promise@3.1.2",
|
"rxjs": "npm:rxjs@5.0.0-beta.3",
|
||||||
"es6-shim": "npm:es6-shim@0.33.13",
|
"zone.js": "npm:zone.js@0.5.15"
|
||||||
"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:argparse@1.0.3": {
|
"npm:argparse@1.0.3": {
|
||||||
"assert": "github:jspm/nodelibs-assert@0.1.0",
|
"assert": "github:jspm/nodelibs-assert@0.1.0",
|
||||||
|
@ -419,9 +416,6 @@ System.config({
|
||||||
"npm:es6-promise@3.1.2": {
|
"npm:es6-promise@3.1.2": {
|
||||||
"process": "github:jspm/nodelibs-process@0.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": {
|
"npm:esprima@2.7.1": {
|
||||||
"fs": "github:jspm/nodelibs-fs@0.1.2",
|
"fs": "github:jspm/nodelibs-fs@0.1.2",
|
||||||
"process": "github:jspm/nodelibs-process@0.1.2"
|
"process": "github:jspm/nodelibs-process@0.1.2"
|
||||||
|
@ -691,10 +685,6 @@ System.config({
|
||||||
"string_decoder": "npm:string_decoder@0.10.31",
|
"string_decoder": "npm:string_decoder@0.10.31",
|
||||||
"util-deprecate": "npm:util-deprecate@1.0.2"
|
"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": {
|
"npm:request@2.67.0": {
|
||||||
"aws-sign2": "npm:aws-sign2@0.6.0",
|
"aws-sign2": "npm:aws-sign2@0.6.0",
|
||||||
"bl": "npm:bl@1.0.0",
|
"bl": "npm:bl@1.0.0",
|
||||||
|
@ -732,7 +722,7 @@ System.config({
|
||||||
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
|
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
|
||||||
"process": "github:jspm/nodelibs-process@0.1.2"
|
"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",
|
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
|
||||||
"process": "github:jspm/nodelibs-process@0.1.2"
|
"process": "github:jspm/nodelibs-process@0.1.2"
|
||||||
},
|
},
|
||||||
|
@ -866,10 +856,6 @@ System.config({
|
||||||
"systemjs-json": "github:systemjs/plugin-json@0.1.0",
|
"systemjs-json": "github:systemjs/plugin-json@0.1.0",
|
||||||
"util": "github:jspm/nodelibs-util@0.1.0",
|
"util": "github:jspm/nodelibs-util@0.1.0",
|
||||||
"validator": "npm:validator@4.5.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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user