mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-29 03:53:43 +03:00
default es6 export + REDOC_COMPONENTS
This commit is contained in:
parent
98f0cdd1ec
commit
f8590bb4dd
|
@ -7,7 +7,7 @@ import {RedocComponent, BaseComponent} from '../base';
|
||||||
styleUrls: ['./lib/components/ApiInfo/api-info.css'],
|
styleUrls: ['./lib/components/ApiInfo/api-info.css'],
|
||||||
templateUrl: './lib/components/ApiInfo/api-info.html'
|
templateUrl: './lib/components/ApiInfo/api-info.html'
|
||||||
})
|
})
|
||||||
export class ApiInfo extends BaseComponent {
|
export default class ApiInfo extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {ElementRef} from 'angular2/angular2';
|
||||||
selector: 'schema',
|
selector: 'schema',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class JsonSchemaView extends BaseComponent {
|
export default class JsonSchemaView extends BaseComponent {
|
||||||
constructor(schemaMgr, elementRef) {
|
constructor(schemaMgr, elementRef) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
this.element = elementRef.nativeElement;
|
this.element = elementRef.nativeElement;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
import {JsonPointer} from '../../utils/JsonPointer';
|
import {JsonPointer} from '../../utils/JsonPointer';
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {ParamsList} from '../ParamsList/params-list';
|
import ParamsList from '../ParamsList/params-list';
|
||||||
import {ResponsesList} from '../ResponsesList/responses-list';
|
import ResponsesList from '../ResponsesList/responses-list';
|
||||||
import {ResponsesSamples} from '../ResponsesSamples/responses-samples';
|
import ResponsesSamples from '../ResponsesSamples/responses-samples';
|
||||||
import {SchemaSample} from '../SchemaSample/schema-sample';
|
import SchemaSample from '../SchemaSample/schema-sample';
|
||||||
|
|
||||||
@RedocComponent({
|
@RedocComponent({
|
||||||
selector: 'method',
|
selector: 'method',
|
||||||
|
@ -13,7 +13,7 @@ import {SchemaSample} from '../SchemaSample/schema-sample';
|
||||||
styleUrls: ['./lib/components/Method/method.css'],
|
styleUrls: ['./lib/components/Method/method.css'],
|
||||||
directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample]
|
directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample]
|
||||||
})
|
})
|
||||||
export class Method extends BaseComponent {
|
export default class Method extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {Method} from '../Method/method';
|
import Method from '../Method/method';
|
||||||
|
|
||||||
@RedocComponent({
|
@RedocComponent({
|
||||||
selector: 'methods-list',
|
selector: 'methods-list',
|
||||||
|
@ -9,7 +9,7 @@ import {Method} from '../Method/method';
|
||||||
styleUrls: ['./lib/components/MethodsList/methods-list.css'],
|
styleUrls: ['./lib/components/MethodsList/methods-list.css'],
|
||||||
directives: [Method]
|
directives: [Method]
|
||||||
})
|
})
|
||||||
export class MethodsList extends BaseComponent {
|
export default class MethodsList extends BaseComponent {
|
||||||
|
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
|
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
|
||||||
|
|
||||||
@RedocComponent({
|
@RedocComponent({
|
||||||
selector: 'params-list',
|
selector: 'params-list',
|
||||||
|
@ -9,7 +9,7 @@ import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
|
||||||
styleUrls: ['./lib/components/ParamsList/params-list.css'],
|
styleUrls: ['./lib/components/ParamsList/params-list.css'],
|
||||||
directives: [JsonSchemaView]
|
directives: [JsonSchemaView]
|
||||||
})
|
})
|
||||||
export class ParamsList extends BaseComponent {
|
export default class ParamsList extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {SchemaManager} from '../../utils/SchemaManager';
|
import SchemaManager from '../../utils/SchemaManager';
|
||||||
import {ApiInfo} from '../ApiInfo/api-info';
|
import ApiInfo from '../ApiInfo/api-info';
|
||||||
import {MethodsList} from '../MethodsList/methods-list';
|
import MethodsList from '../MethodsList/methods-list';
|
||||||
|
|
||||||
@RedocComponent({
|
@RedocComponent({
|
||||||
selector: 'redoc',
|
selector: 'redoc',
|
||||||
|
@ -11,7 +11,7 @@ import {MethodsList} from '../MethodsList/methods-list';
|
||||||
templateUrl: './lib/components/Redoc/redoc.html',
|
templateUrl: './lib/components/Redoc/redoc.html',
|
||||||
directives: [ApiInfo, MethodsList]
|
directives: [ApiInfo, MethodsList]
|
||||||
})
|
})
|
||||||
export class Redoc extends BaseComponent {
|
export default class Redoc extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {JsonPointer} from '../../utils/JsonPointer';
|
import JsonPointer from '../../utils/JsonPointer';
|
||||||
import {JsonSchemaView} from '../JsonSchemaView/json-schema-view';
|
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
|
||||||
|
|
||||||
function isNumeric(n) {
|
function isNumeric(n) {
|
||||||
return (!isNaN(parseFloat(n)) && isFinite(n));
|
return (!isNaN(parseFloat(n)) && isFinite(n));
|
||||||
|
@ -14,7 +14,7 @@ function isNumeric(n) {
|
||||||
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
|
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
|
||||||
directives: [JsonSchemaView]
|
directives: [JsonSchemaView]
|
||||||
})
|
})
|
||||||
export class ResponsesList extends BaseComponent {
|
export default class ResponsesList extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {JsonPointer} from '../../utils/JsonPointer';
|
import JsonPointer from '../../utils/JsonPointer';
|
||||||
import {Tabs, Tab} from '../../common-components/Tabs/tabs';
|
import {Tabs, Tab} from '../../common-components/Tabs/tabs';
|
||||||
import {SchemaSample} from '../SchemaSample/schema-sample';
|
import SchemaSample from '../SchemaSample/schema-sample';
|
||||||
|
|
||||||
|
|
||||||
function isNumeric(n) {
|
function isNumeric(n) {
|
||||||
|
@ -21,7 +21,7 @@ function hasExample(response) {
|
||||||
styleUrls: ['./lib/components/ResponsesSamples/responses-samples.css'],
|
styleUrls: ['./lib/components/ResponsesSamples/responses-samples.css'],
|
||||||
directives: [SchemaSample, Tabs, Tab]
|
directives: [SchemaSample, Tabs, Tab]
|
||||||
})
|
})
|
||||||
export class ResponsesSamples extends BaseComponent {
|
export default class ResponsesSamples extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import SchemaSampler from 'json-schema-instantiator';
|
||||||
selector: 'schema-sample',
|
selector: 'schema-sample',
|
||||||
templateUrl: './lib/components/SchemaSample/schema-sample.html'
|
templateUrl: './lib/components/SchemaSample/schema-sample.html'
|
||||||
})
|
})
|
||||||
export class SchemaSample extends BaseComponent {
|
export default class SchemaSample extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import {SchemaManager} from '../../utils/SchemaManager';
|
import SchemaManager from '../../utils/SchemaManager';
|
||||||
import {SideMenuCat} from '../SideMenuCat/side-menu-cat';
|
import SideMenuCat from '../SideMenuCat/side-menu-cat';
|
||||||
import {NgZone} from 'angular2/angular2';
|
import {NgZone} from 'angular2/angular2';
|
||||||
|
|
||||||
const CHANGE = {
|
const CHANGE = {
|
||||||
|
@ -18,7 +18,7 @@ const CHANGE = {
|
||||||
styleUrls: ['./lib/components/SideMenu/side-menu.css'],
|
styleUrls: ['./lib/components/SideMenu/side-menu.css'],
|
||||||
directives: [SideMenuCat]
|
directives: [SideMenuCat]
|
||||||
})
|
})
|
||||||
export class SideMenu extends BaseComponent {
|
export default class SideMenu extends BaseComponent {
|
||||||
constructor(schemaMgr, zone) {
|
constructor(schemaMgr, zone) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
this.zone = zone;
|
this.zone = zone;
|
||||||
|
@ -129,4 +129,4 @@ export class SideMenu extends BaseComponent {
|
||||||
this.changeActive(CHANGE.INITIAL);
|
this.changeActive(CHANGE.INITIAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SideMenu.parameters.push([NgZone]);
|
SideMenu.parameters = SideMenu.parameters.concat([NgZone]);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {EventEmitter} from 'angular2/angular2';
|
||||||
styleUrls: ['./lib/components/SideMenuCat/side-menu-cat.css'],
|
styleUrls: ['./lib/components/SideMenuCat/side-menu-cat.css'],
|
||||||
templateUrl: './lib/components/SideMenuCat/side-menu-cat.html'
|
templateUrl: './lib/components/SideMenuCat/side-menu-cat.html'
|
||||||
})
|
})
|
||||||
export class SideMenuCat extends BaseComponent {
|
export default class SideMenuCat extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
super(schemaMgr);
|
super(schemaMgr);
|
||||||
this.expand = new EventEmitter();
|
this.expand = new EventEmitter();
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
import {Component, View, OnInit, CORE_DIRECTIVES} from 'angular2/angular2';
|
import {Component, View, OnInit, CORE_DIRECTIVES} from 'angular2/angular2';
|
||||||
import {SchemaManager} from '../utils/SchemaManager';
|
import SchemaManager from '../utils/SchemaManager';
|
||||||
import {JsonPointerEscapePipe} from '../utils/pipes';
|
import JsonPointer from '../utils/JsonPointer';
|
||||||
import {JsonPointer} from '../utils/JsonPointer';
|
import {MarkedPipe, JsonPointerEscapePipe} from '../utils/pipes';
|
||||||
import {MarkedPipe} from '../utils/pipes';
|
|
||||||
|
|
||||||
// common inputs for all components
|
// common inputs for all components
|
||||||
let commonInputs = ['pointer']; // json pointer to the schema chunk
|
let commonInputs = ['pointer']; // json pointer to the schema chunk
|
||||||
|
|
|
@ -1,5 +1,42 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
export * from './Redoc/redoc';
|
import ApiInfo from './ApiInfo/api-info';
|
||||||
export * from './SideMenu/side-menu';
|
import JsonSchemaView from './JsonSchemaView/json-schema-view';
|
||||||
export * from './ApiInfo/api-info';
|
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
|
||||||
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import {bootstrap} from 'angular2/angular2';
|
import {bootstrap} from 'angular2/angular2';
|
||||||
import {Redoc, SideMenu} from './components/index';
|
import {Redoc, SideMenu} from './components/index';
|
||||||
import { SchemaManager} from './utils/SchemaManager';
|
import SchemaManager from './utils/SchemaManager';
|
||||||
|
|
||||||
export * from './components/index';
|
export * from './components/index';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import SwaggerParser from 'swagger-parser';
|
||||||
import JsonPointer from './JsonPointer';
|
import JsonPointer from './JsonPointer';
|
||||||
import {methods as swaggerMethods} from './swagger-defs';
|
import {methods as swaggerMethods} from './swagger-defs';
|
||||||
|
|
||||||
export class SchemaManager {
|
export default class SchemaManager {
|
||||||
constructor() {
|
constructor() {
|
||||||
if (SchemaManager.prototype._instance) {
|
if (SchemaManager.prototype._instance) {
|
||||||
return SchemaManager.prototype._instance;
|
return SchemaManager.prototype._instance;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user