IE10, IE9 Fixes

Use Reflect.metadate decorator instead of Class.parameters
Add fallback old syntax of flexbox
Other minor styling fixes
This commit is contained in:
Roman Hotsiy 2016-02-10 13:19:50 +02:00
parent f723240145
commit db7f500ba0
15 changed files with 59 additions and 37 deletions

View File

@ -9,7 +9,8 @@
"globals": { "globals": {
"should": true, "should": true,
"expect": true, "expect": true,
"sinon": true "sinon": true,
"Reflect": true
}, },
"rules": { "rules": {
"quotes": [2, "single"], "quotes": [2, "single"],

View File

@ -7,6 +7,7 @@ import {BrowserDomAdapter} from 'angular2/platform/browser';
selector: '[sticky-sidebar]', selector: '[sticky-sidebar]',
inputs: ['scrollParent', 'scrollYOffset'] inputs: ['scrollParent', 'scrollYOffset']
}) })
@Reflect.metadata('parameters', [[ElementRef], [BrowserDomAdapter]])
export default class StickySidebar { export default class StickySidebar {
constructor(elementRef, dom) { constructor(elementRef, dom) {
this.element = elementRef.nativeElement; this.element = elementRef.nativeElement;
@ -59,5 +60,3 @@ export default class StickySidebar {
this.unbind(); this.unbind();
} }
} }
StickySidebar.parameters = [ [ElementRef], [BrowserDomAdapter] ];

View File

@ -65,16 +65,24 @@ export class Tabs {
}) })
@View({ @View({
template: ` template: `
<div class="tab-wrap" [hidden]="!active"> <div class="tab-wrap" [ngClass]="{ 'active': active }">
<ng-content></ng-content> <ng-content></ng-content>
</div> </div>
` `,
styles: [`
.tab-wrap {
display: none;
}
.tab-wrap.active {
display: block;
}`
]
}) })
@Reflect.metadata('parameters', [ [Tabs] ])
export class Tab { export class Tab {
constructor(tabs) { constructor(tabs) {
this.active = false; this.active = false;
tabs.addTab(this); tabs.addTab(this);
} }
} }
Tab.parameters = [ [ Tabs ] ];

View File

@ -15,6 +15,6 @@ $samples-panel-width: 40%;
$sample-panel-headers-color: #8A9094; $sample-panel-headers-color: #8A9094;
$sample-panel-color: #CFD2D3; $sample-panel-color: #CFD2D3;
$tree-lines-color: #7D97CE; $tree-lines-color: #CDD9F3;//#7D97CE;
$side-menu-mobile-breakpoint: 1000px; $side-menu-mobile-breakpoint: 1000px;

View File

@ -30,6 +30,8 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
} }
.param-name { .param-name {
flex-grow: 0;
-ms-flex-grow: 0;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
padding: $cell-padding 0 $cell-padding 0; padding: $cell-padding 0 $cell-padding 0;
@ -47,7 +49,9 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
} }
.param-info { .param-info {
width: 100%; //width: 100%;
flex-grow: 1;
-ms-flex-grow: 1;
padding: $cell-padding 0; padding: $cell-padding 0;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
@ -56,6 +60,7 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
.param { .param {
display: flex; display: flex;
display: -ms-flexbox;
} }
.param-required { .param-required {

View File

@ -2,8 +2,9 @@
import {Component, View, ElementRef} from 'angular2/core'; import {Component, View, ElementRef} from 'angular2/core';
import {CORE_DIRECTIVES} from 'angular2/common'; import {CORE_DIRECTIVES} from 'angular2/common';
import JsonSchema from './json-schema';
import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader';
import JsonSchema from './json-schema';
import OptionsManager from '../../options'; import OptionsManager from '../../options';
import SchemaManager from '../../utils/SchemaManager'; import SchemaManager from '../../utils/SchemaManager';
@ -19,6 +20,7 @@ var cache = {};
template: '', template: '',
directives: [CORE_DIRECTIVES] directives: [CORE_DIRECTIVES]
}) })
@Reflect.metadata('parameters', [[ElementRef], [DynamicComponentLoader]])
export default class JsonSchemaLazy { export default class JsonSchemaLazy {
constructor(elementRef, dcl) { constructor(elementRef, dcl) {
@ -79,5 +81,3 @@ export default class JsonSchemaLazy {
function insertAfter(newNode, referenceNode) { function insertAfter(newNode, referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
} }
JsonSchemaLazy.parameters = [[ElementRef], [DynamicComponentLoader]];

View File

@ -1,8 +1,9 @@
'use strict'; 'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {Tabs, Tab} from '../../common/components/Tabs/tabs';
import {ElementRef} from 'angular2/core'; import {ElementRef} from 'angular2/core';
import {RedocComponent, BaseComponent, SchemaManager} from '../base';
import {Tabs, Tab} from '../../common/components/Tabs/tabs';
import JsonPointer from '../../utils/JsonPointer'; import JsonPointer from '../../utils/JsonPointer';
@RedocComponent({ @RedocComponent({
@ -12,6 +13,7 @@ import JsonPointer from '../../utils/JsonPointer';
directives: [JsonSchema, Tabs, Tab], directives: [JsonSchema, Tabs, Tab],
inputs: ['isArray', 'final'] inputs: ['isArray', 'final']
}) })
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
export default class JsonSchema extends BaseComponent { export default class JsonSchema extends BaseComponent {
constructor(schemaMgr, elementRef) { constructor(schemaMgr, elementRef) {
super(schemaMgr); super(schemaMgr);
@ -152,4 +154,3 @@ export default class JsonSchema extends BaseComponent {
} }
} }
} }
JsonSchema.parameters = JsonSchema.parameters.concat([[ElementRef]]);

View File

@ -2,6 +2,7 @@
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';

View File

@ -1,5 +1,12 @@
'use strict'; 'use strict';
import {ChangeDetectionStrategy} from 'angular2/core';
import {ElementRef} from 'angular2/core';
import {BrowserDomAdapter, bootstrap} from 'angular2/platform/browser';
import detectScollParent from 'scrollparent';
import {isFunction, isString} from 'angular2/src/facade/lang';
import {RedocComponent, BaseComponent} from '../base'; import {RedocComponent, BaseComponent} from '../base';
import SchemaManager from '../../utils/SchemaManager'; import SchemaManager from '../../utils/SchemaManager';
@ -11,13 +18,6 @@ import StickySidebar from '../../common/components/StickySidebar/sticky-sidebar'
import OptionsManager from '../../options'; import OptionsManager from '../../options';
import {redocEvents} from '../../events'; import {redocEvents} from '../../events';
import {ChangeDetectionStrategy} from 'angular2/core';
import {ElementRef} from 'angular2/core';
import {BrowserDomAdapter, bootstrap} from 'angular2/platform/browser';
import detectScollParent from 'scrollparent';
import {isFunction, isString} from 'angular2/src/facade/lang';
let optionNames = new Set(['scrollYOffset', 'disableLazySchemas']); let optionNames = new Set(['scrollYOffset', 'disableLazySchemas']);
let dom = new BrowserDomAdapter(); let dom = new BrowserDomAdapter();
@ -30,6 +30,7 @@ let dom = new BrowserDomAdapter();
directives: [ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar], directives: [ApiInfo, ApiLogo, MethodsList, SideMenu, StickySidebar],
changeDetection: ChangeDetectionStrategy.Default changeDetection: ChangeDetectionStrategy.Default
}) })
@Reflect.metadata('parameters', [[SchemaManager], [OptionsManager], [ElementRef], [BrowserDomAdapter]])
export default class Redoc extends BaseComponent { export default class Redoc extends BaseComponent {
constructor(schemaMgr, optionsMgr, elementRef, dom) { constructor(schemaMgr, optionsMgr, elementRef, dom) {
super(schemaMgr); super(schemaMgr);
@ -100,6 +101,7 @@ export default class Redoc extends BaseComponent {
25% {transform: translateY(0px)} 25% {transform: translateY(0px)}
50% {transform: translateY(10px)} 50% {transform: translateY(10px)}
75% {transform: translateY(20px)} 75% {transform: translateY(20px)}
100% {transform: translateY(10px)}
} }
redoc.loading:before { redoc.loading:before {
@ -200,4 +202,3 @@ export default class Redoc extends BaseComponent {
} }
} }
} }
Redoc.parameters = Redoc.parameters.concat([[OptionsManager], [ElementRef], [BrowserDomAdapter]]);

View File

@ -1,12 +1,12 @@
'use strict'; 'use strict';
import {RedocComponent, BaseComponent} from '../base'; import {ViewChildren, QueryList, ChangeDetectorRef, ChangeDetectionStrategy} from 'angular2/core';
import {RedocComponent, BaseComponent, SchemaManager} 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';
import {PrismPipe} from '../../utils/pipes'; import {PrismPipe} from '../../utils/pipes';
import {ViewChildren, QueryList, ChangeDetectorRef, ChangeDetectionStrategy} from 'angular2/core';
import {redocEvents} from '../../events'; import {redocEvents} from '../../events';
@RedocComponent({ @RedocComponent({
@ -18,6 +18,7 @@ import {redocEvents} from '../../events';
pipes: [PrismPipe], pipes: [PrismPipe],
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
@Reflect.metadata('parameters', [[SchemaManager], [new ViewChildren(Tabs), QueryList], [ChangeDetectorRef]])
export default class RequestSamples extends BaseComponent { export default class RequestSamples extends BaseComponent {
constructor(schemaMgr, tabs, changeDetector) { constructor(schemaMgr, tabs, changeDetector) {
super(schemaMgr); super(schemaMgr);
@ -46,5 +47,3 @@ export default class RequestSamples extends BaseComponent {
this.data.samples = this.componentSchema['x-code-samples'] || []; this.data.samples = this.componentSchema['x-code-samples'] || [];
} }
} }
RequestSamples.parameters = RequestSamples.parameters.concat([ [new ViewChildren(Tabs), QueryList], [ChangeDetectorRef] ]);

View File

@ -1,11 +1,11 @@
'use strict'; 'use strict';
import {RedocComponent, BaseComponent} from '../base'; import {ElementRef} from 'angular2/core';
import SchemaSampler from 'json-schema-instantiator'; import SchemaSampler from 'json-schema-instantiator';
import {JsonFormatter} from '../../utils/JsonFormatterPipe'; import {JsonFormatter} from '../../utils/JsonFormatterPipe';
import {ElementRef} from 'angular2/core'; import {RedocComponent, BaseComponent, SchemaManager} from '../base';
@RedocComponent({ @RedocComponent({
selector: 'schema-sample', selector: 'schema-sample',
@ -13,6 +13,7 @@ import {ElementRef} from 'angular2/core';
pipes: [JsonFormatter], pipes: [JsonFormatter],
styleUrls: ['./lib/components/SchemaSample/schema-sample.css'] styleUrls: ['./lib/components/SchemaSample/schema-sample.css']
}) })
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
export default class SchemaSample extends BaseComponent { export default class SchemaSample extends BaseComponent {
constructor(schemaMgr, elementRef) { constructor(schemaMgr, elementRef) {
super(schemaMgr); super(schemaMgr);
@ -54,4 +55,3 @@ export default class SchemaSample extends BaseComponent {
}); });
} }
} }
SchemaSample.parameters = SchemaSample.parameters.concat([[ElementRef]]);

View File

@ -1,14 +1,14 @@
'use strict'; 'use strict';
import {RedocComponent, BaseComponent} from '../base';
import {redocEvents} from '../../events';
import {NgZone, ChangeDetectionStrategy, ElementRef, forwardRef} from 'angular2/core'; import {NgZone, ChangeDetectionStrategy, ElementRef, forwardRef} from 'angular2/core';
import Redoc from '../Redoc/redoc'; import Redoc from '../Redoc/redoc';
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';
import {RedocComponent, BaseComponent, SchemaManager} from '../base';
import {redocEvents} from '../../events';
const CHANGE = { const CHANGE = {
NEXT : 1, NEXT : 1,
BACK : -1, BACK : -1,
@ -27,6 +27,8 @@ const INVIEW_POSITION = {
styleUrls: ['./lib/components/SideMenu/side-menu.css'], styleUrls: ['./lib/components/SideMenu/side-menu.css'],
changeDetection: ChangeDetectionStrategy.Default changeDetection: ChangeDetectionStrategy.Default
}) })
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef],
[BrowserDomAdapter], [NgZone], [forwardRef(() => Redoc)]])
export default class SideMenu extends BaseComponent { export default class SideMenu extends BaseComponent {
constructor(schemaMgr, elementRef, adapter, zone, redoc) { constructor(schemaMgr, elementRef, adapter, zone, redoc) {
super(schemaMgr); super(schemaMgr);
@ -254,5 +256,5 @@ export default class SideMenu extends BaseComponent {
this.changeActive(CHANGE.INITIAL); this.changeActive(CHANGE.INITIAL);
} }
} }
SideMenu.parameters = SideMenu.parameters.concat([[ElementRef], //SideMenu.parameters = SideMenu.parameters.concat([[ElementRef],
[BrowserDomAdapter], [NgZone], [forwardRef(() => Redoc)] ]); // [BrowserDomAdapter], [NgZone], [forwardRef(() => Redoc)] ]);

View File

@ -5,6 +5,8 @@ import SchemaManager from '../utils/SchemaManager';
import JsonPointer from '../utils/JsonPointer'; import JsonPointer from '../utils/JsonPointer';
import {MarkedPipe, JsonPointerEscapePipe} from '../utils/pipes'; import {MarkedPipe, JsonPointerEscapePipe} from '../utils/pipes';
export { SchemaManager };
// 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
@ -77,6 +79,7 @@ export function RedocComponent(options) {
* Generic Component * Generic Component
* @class * @class
*/ */
@Reflect.metadata('parameters', [[SchemaManager]])
export class BaseComponent { export class BaseComponent {
constructor(schemaMgr) { constructor(schemaMgr) {
this.schemaMgr = schemaMgr; this.schemaMgr = schemaMgr;
@ -208,4 +211,3 @@ export class BaseComponent {
*/ */
destroy() {} destroy() {}
} }
BaseComponent.parameters = [[SchemaManager]];

View File

@ -63,4 +63,6 @@ export class JsonPointer extends JsonPointerLib {
JsonPointerLib._origParse = JsonPointerLib.parse; JsonPointerLib._origParse = JsonPointerLib.parse;
JsonPointerLib.parse = JsonPointer.parse; JsonPointerLib.parse = JsonPointer.parse;
Object.assign(JsonPointer, JsonPointerLib);
export default JsonPointer; export default JsonPointer;

View File

@ -5,6 +5,7 @@ import {isString, stringify, isBlank} from 'angular2/src/facade/lang';
import {BaseException} from 'angular2/src/facade/exceptions'; import {BaseException} from 'angular2/src/facade/exceptions';
import {JsonPointer} from './JsonPointer'; import {JsonPointer} from './JsonPointer';
import marked from 'marked'; import marked from 'marked';
import Prism from 'prismjs'; import Prism from 'prismjs';
import 'prismjs/components/prism-actionscript.js'; import 'prismjs/components/prism-actionscript.js';
import 'prismjs/components/prism-c.js'; import 'prismjs/components/prism-c.js';