From 5decc3ceb5c729c38e34228dda790db9baa08b58 Mon Sep 17 00:00:00 2001 From: Cesar Date: Fri, 18 Mar 2016 09:06:22 -0400 Subject: [PATCH] merge with origin --- lib/components/JsonSchema/json-schema.html | 18 +++++++++++------- lib/components/JsonSchema/json-schema.js | 9 +++++++++ lib/components/JsonSchema/json-schema.scss | 20 ++++++++++++++------ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html index c22bc7e8..6d2d4e8a 100644 --- a/lib/components/JsonSchema/json-schema.html +++ b/lib/components/JsonSchema/json-schema.html @@ -20,7 +20,13 @@
-
This field value determines the exact schema:
+
+ This field value determines the exact schema: + +
@@ -32,12 +38,10 @@ - - - - - - +
+ + +
diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index c5ef5430..31215928 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -21,6 +21,14 @@ export default class JsonSchema extends BaseComponent { this.final = false; } + selectDerived(subClass) { + if (subClass.active) return; + this.data.derived.forEach((subSchema) => { + subSchema.active = false; + }); + subClass.active = true; + } + prepareModel() { this.data = {}; this.data.properties = []; @@ -43,6 +51,7 @@ export default class JsonSchema extends BaseComponent { let normPtr = schema._pointer || this.pointer; let derived = this.schemaMgr.findDerivedDefinitions( normPtr ); if (!this.final && derived.length) { + derived[0].active = true; this.data.derived = derived; this.data.discriminator = schema.discriminator; } diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss index 18bd21cb..ff5350d5 100644 --- a/lib/components/JsonSchema/json-schema.scss +++ b/lib/components/JsonSchema/json-schema.scss @@ -12,6 +12,13 @@ $array-marker-line-height: 1.5; padding: 0 10px; } +.derived-schema { + display: none; +} +.derived-schema.active { + display: block; +} + json-schema.nested-schema { background-color: $side-menu-active-bg-color; padding: 10px 20px; @@ -114,15 +121,14 @@ json-schema.nested-schema { padding: 0; } -:host tabs { +ul { + text-align: left; + margin: 0; + padding: 0; display: block; } -:host ul { - text-align: center; -} - -:host tabs li { +li { margin: 0.2em 0.3em 0.2em 0; font-family: $headers-font, $headers-font-family; font-size: .929em; @@ -132,6 +138,8 @@ json-schema.nested-schema { padding: 2px 8px 4px 8px; border-radius: $border-radius; background-color: rgba($black, 0.3); + display: inline-block; + cursor: pointer; &:last-of-type { margin-right: 0;