default es6 export + REDOC_COMPONENTS

This commit is contained in:
Roman Gotsiy 2015-10-27 19:44:08 +02:00
parent 98f0cdd1ec
commit f8590bb4dd
15 changed files with 75 additions and 39 deletions

View File

@ -7,7 +7,7 @@ import {RedocComponent, BaseComponent} from '../base';
styleUrls: ['./lib/components/ApiInfo/api-info.css'],
templateUrl: './lib/components/ApiInfo/api-info.html'
})
export class ApiInfo extends BaseComponent {
export default class ApiInfo extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -14,7 +14,7 @@ import {ElementRef} from 'angular2/angular2';
selector: 'schema',
template: ''
})
export class JsonSchemaView extends BaseComponent {
export default class JsonSchemaView extends BaseComponent {
constructor(schemaMgr, elementRef) {
super(schemaMgr);
this.element = elementRef.nativeElement;

View File

@ -2,10 +2,10 @@
import {JsonPointer} from '../../utils/JsonPointer';
import {RedocComponent, BaseComponent} from '../base';
import {ParamsList} from '../ParamsList/params-list';
import {ResponsesList} from '../ResponsesList/responses-list';
import {ResponsesSamples} from '../ResponsesSamples/responses-samples';
import {SchemaSample} from '../SchemaSample/schema-sample';
import ParamsList from '../ParamsList/params-list';
import ResponsesList from '../ResponsesList/responses-list';
import ResponsesSamples from '../ResponsesSamples/responses-samples';
import SchemaSample from '../SchemaSample/schema-sample';
@RedocComponent({
selector: 'method',
@ -13,7 +13,7 @@ import {SchemaSample} from '../SchemaSample/schema-sample';
styleUrls: ['./lib/components/Method/method.css'],
directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample]
})
export class Method extends BaseComponent {
export default class Method extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -1,7 +1,7 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {Method} from '../Method/method';
import Method from '../Method/method';
@RedocComponent({
selector: 'methods-list',
@ -9,7 +9,7 @@ import {Method} from '../Method/method';
styleUrls: ['./lib/components/MethodsList/methods-list.css'],
directives: [Method]
})
export class MethodsList extends BaseComponent {
export default class MethodsList extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);

View File

@ -1,7 +1,7 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
@RedocComponent({
selector: 'params-list',
@ -9,7 +9,7 @@ import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
styleUrls: ['./lib/components/ParamsList/params-list.css'],
directives: [JsonSchemaView]
})
export class ParamsList extends BaseComponent {
export default class ParamsList extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -1,9 +1,9 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {SchemaManager} from '../../utils/SchemaManager';
import {ApiInfo} from '../ApiInfo/api-info';
import {MethodsList} from '../MethodsList/methods-list';
import SchemaManager from '../../utils/SchemaManager';
import ApiInfo from '../ApiInfo/api-info';
import MethodsList from '../MethodsList/methods-list';
@RedocComponent({
selector: 'redoc',
@ -11,7 +11,7 @@ import {MethodsList} from '../MethodsList/methods-list';
templateUrl: './lib/components/Redoc/redoc.html',
directives: [ApiInfo, MethodsList]
})
export class Redoc extends BaseComponent {
export default class Redoc extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -1,8 +1,8 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {JsonPointer} from '../../utils/JsonPointer';
import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
import JsonPointer from '../../utils/JsonPointer';
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
function isNumeric(n) {
return (!isNaN(parseFloat(n)) && isFinite(n));
@ -14,7 +14,7 @@ function isNumeric(n) {
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
directives: [JsonSchemaView]
})
export class ResponsesList extends BaseComponent {
export default class ResponsesList extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -1,9 +1,9 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {JsonPointer} from '../../utils/JsonPointer';
import JsonPointer from '../../utils/JsonPointer';
import {Tabs, Tab} from '../../common-components/Tabs/tabs';
import {SchemaSample} from '../SchemaSample/schema-sample';
import SchemaSample from '../SchemaSample/schema-sample';
function isNumeric(n) {
@ -21,7 +21,7 @@ function hasExample(response) {
styleUrls: ['./lib/components/ResponsesSamples/responses-samples.css'],
directives: [SchemaSample, Tabs, Tab]
})
export class ResponsesSamples extends BaseComponent {
export default class ResponsesSamples extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -8,7 +8,7 @@ import SchemaSampler from 'json-schema-instantiator';
selector: 'schema-sample',
templateUrl: './lib/components/SchemaSample/schema-sample.html'
})
export class SchemaSample extends BaseComponent {
export default class SchemaSample extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
}

View File

@ -1,8 +1,8 @@
'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {SchemaManager} from '../../utils/SchemaManager';
import {SideMenuCat} from '../SideMenuCat/side-menu-cat';
import SchemaManager from '../../utils/SchemaManager';
import SideMenuCat from '../SideMenuCat/side-menu-cat';
import {NgZone} from 'angular2/angular2';
const CHANGE = {
@ -15,10 +15,10 @@ const CHANGE = {
selector: 'side-menu',
providers: [SchemaManager],
templateUrl: './lib/components/SideMenu/side-menu.html',
styleUrls: ['./lib/components/SideMenu/side-menu.css'],
styleUrls: ['./lib/components/SideMenu/side-menu.css'],
directives: [SideMenuCat]
})
export class SideMenu extends BaseComponent {
export default class SideMenu extends BaseComponent {
constructor(schemaMgr, zone) {
super(schemaMgr);
this.zone = zone;
@ -129,4 +129,4 @@ export class SideMenu extends BaseComponent {
this.changeActive(CHANGE.INITIAL);
}
}
SideMenu.parameters.push([NgZone]);
SideMenu.parameters = SideMenu.parameters.concat([NgZone]);

View File

@ -10,7 +10,7 @@ import {EventEmitter} from 'angular2/angular2';
styleUrls: ['./lib/components/SideMenuCat/side-menu-cat.css'],
templateUrl: './lib/components/SideMenuCat/side-menu-cat.html'
})
export class SideMenuCat extends BaseComponent {
export default class SideMenuCat extends BaseComponent {
constructor(schemaMgr) {
super(schemaMgr);
this.expand = new EventEmitter();

View File

@ -1,9 +1,8 @@
'use strict';
import {Component, View, OnInit, CORE_DIRECTIVES} from 'angular2/angular2';
import {SchemaManager} from '../utils/SchemaManager';
import {JsonPointerEscapePipe} from '../utils/pipes';
import {JsonPointer} from '../utils/JsonPointer';
import {MarkedPipe} from '../utils/pipes';
import SchemaManager from '../utils/SchemaManager';
import JsonPointer from '../utils/JsonPointer';
import {MarkedPipe, JsonPointerEscapePipe} from '../utils/pipes';
// common inputs for all components
let commonInputs = ['pointer']; // json pointer to the schema chunk

View File

@ -1,5 +1,42 @@
'use strict';
export * from './Redoc/redoc';
export * from './SideMenu/side-menu';
export * from './ApiInfo/api-info';
import ApiInfo from './ApiInfo/api-info';
import JsonSchemaView from './JsonSchemaView/json-schema-view';
import Method from './Method/method.js';
import MethodsList from './MethodsList/methods-list';
import ParamsList from './ParamsList/params-list';
import Redoc from './Redoc/redoc';
import ResponsesList from './ResponsesList/responses-list';
import ResponsesSamples from './ResponsesSamples/responses-samples';
import SchemaSample from './SchemaSample/schema-sample';
import SideMenu from './SideMenu/side-menu';
import SideMenuCat from './SideMenuCat/side-menu-cat';
const REDOC_COMPONENTS = [
ApiInfo,
JsonSchemaView,
Method,
MethodsList,
ParamsList,
Redoc,
ResponsesList,
ResponsesSamples,
SchemaSample,
SideMenu,
SideMenuCat
];
export {
ApiInfo,
JsonSchemaView,
Method,
MethodsList,
ParamsList,
Redoc,
ResponsesList,
ResponsesSamples,
SchemaSample,
SideMenu,
SideMenuCat,
REDOC_COMPONENTS
};

View File

@ -1,9 +1,9 @@
'use strict';
import 'reflect-metadata';
import { bootstrap } from 'angular2/angular2';
import { Redoc, SideMenu } from './components/index';
import { SchemaManager} from './utils/SchemaManager';
import {bootstrap} from 'angular2/angular2';
import {Redoc, SideMenu} from './components/index';
import SchemaManager from './utils/SchemaManager';
export * from './components/index';

View File

@ -3,7 +3,7 @@ import SwaggerParser from 'swagger-parser';
import JsonPointer from './JsonPointer';
import {methods as swaggerMethods} from './swagger-defs';
export class SchemaManager {
export default class SchemaManager {
constructor() {
if (SchemaManager.prototype._instance) {
return SchemaManager.prototype._instance;