From d5c3a9cc5dab65b88c46a4db6af00a054ddc223f Mon Sep 17 00:00:00 2001
From: Dmitriy Mushat <54553744+Dmitriymush@users.noreply.github.com>
Date: Wed, 19 Feb 2020 16:14:18 +0200
Subject: [PATCH] fixed: focus on fullscreen for react schema grouped forms
 (#2400)
---
 .../components/react/json-form-ace-editor.jsx |  6 ++---
 .../react/json-form-schema-form.jsx           | 25 +++++++++++--------
 ui/src/app/components/react/json-form.scss    |  3 +++
 3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/ui/src/app/components/react/json-form-ace-editor.jsx b/ui/src/app/components/react/json-form-ace-editor.jsx
index 2329bbddf7..966419b3fe 100644
--- a/ui/src/app/components/react/json-form-ace-editor.jsx
+++ b/ui/src/app/components/react/json-form-ace-editor.jsx
@@ -83,9 +83,9 @@ class ThingsboardAceEditor extends React.Component {
         fixAceEditor(editor);
     }
 
-    onToggleFull() {
+    onToggleFull(groupId) {
         this.setState({ isFull: !this.state.isFull });
-        this.props.onToggleFullscreen();
+        this.props.onToggleFullscreen(groupId);
         this.updateAceEditorSize = true;
     }
 
@@ -140,7 +140,7 @@ class ThingsboardAceEditor extends React.Component {
                     
                         
                         
-                        
+                         this.onToggleFull(this.props.groupId)}/>
                     
                     
+        return 
     }
 
-    createSchema(theForm) {
+    createSchema(theForm, groupId) {
         let merged = utils.merge(this.props.schema, theForm, this.props.ignore, this.props.option);
         let mapper = this.mapper;
         if(this.props.mapper) {
             mapper = _.merge(this.mapper, this.props.mapper);
         }
         let forms = merged.map(function(form, index) {
-            return this.builder(form, this.props.model, index, this.onChange, this.onColorClick, this.onIconClick, this.onToggleFullscreen, mapper);
+            return this.builder(form, groupId, this.props.model, index, this.onChange, this.onColorClick, this.onIconClick, this.onToggleFullscreen, mapper);
         }.bind(this));
 
         let formClass = 'SchemaForm';
-        if (this.props.isFullscreen) {
+        if (this.props.isFullscreen && groupId === this.state.groupId) {
             formClass += ' SchemaFormFullscreen';
         }
 
@@ -131,7 +136,7 @@ class ThingsboardSchemaForm extends React.Component {
         if(this.props.groupInfoes&&this.props.groupInfoes.length>0){
             let content=[];
             for(let info of this.props.groupInfoes){
-                let forms = this.createSchema(this.props.form[info.formIndex]);
+                let forms = this.createSchema(this.props.form[info.formIndex], info.formIndex);
                 let item = ;
                 content.push(item);
             }
@@ -165,4 +170,4 @@ class ThingsboardSchemaGroup extends React.Component{
                     {this.props.forms}
                 );
     }
-} 
+}
diff --git a/ui/src/app/components/react/json-form.scss b/ui/src/app/components/react/json-form.scss
index 85825abf42..91c14d51ff 100644
--- a/ui/src/app/components/react/json-form.scss
+++ b/ui/src/app/components/react/json-form.scss
@@ -24,12 +24,15 @@ $input-label-float-scale: .75 !default;
 .tb-fullscreen {
   [name="ReactSchemaForm"] {
     .SchemaForm {
+      display: none;
+
       &.SchemaFormFullscreen {
         position: absolute;
         top: 0;
         right: 0;
         bottom: 0;
         left: 0;
+        display: block;
 
         > div:not(.fullscreen-form-field) {
           display: none !important;