diff --git a/src/plugins/vis_default_editor/public/_default.scss b/src/plugins/vis_default_editor/public/_default.scss index 985f2c73f6efea..c412b9d915e553 100644 --- a/src/plugins/vis_default_editor/public/_default.scss +++ b/src/plugins/vis_default_editor/public/_default.scss @@ -1,10 +1,8 @@ .visEditor--default { + // height: 1px is in place to make editor children take their height in the parent + height: 1px; flex: 1 1 auto; display: flex; - - @include euiBreakpoint('xs', 's', 'm') { - flex-direction: column; - } } /** @@ -12,34 +10,17 @@ */ .visEditor__collapsibleSidebar { - background: $euiColorLightestShade; - min-width: $visEditorSidebarMinWidth; - max-width: 100%; - position: relative; - flex-shrink: 0; - - @include euiBreakpoint('xs', 's', 'm') { - // If we are on a small screen we force the editor to take 100% width. - width: 100% !important; - } - - @include euiBreakpoint('l', 'xl') { - max-width: 75%; - } + flex-grow: 1; } -// !importants on width are required to override resizable panel inline widths +// !importants on width and height are required to override resizable panel inline widths .visEditor__collapsibleSidebar-isClosed { min-width: 0; width: $euiSizeXL !important; // Just enough room for the collapse button .visEditorSidebar { display: none; - } - - @include euiBreakpoint('xs', 's', 'm') { - height: $euiSizeXXL; // Just enough room for the collapse button - width: 100% !important; + padding-left: 0; } } @@ -53,13 +34,6 @@ * Resizer */ -.visEditor__resizer { - @include kbnResizer($euiSizeM); - @include euiBreakpoint('xs', 's', 'm') { - display: none; - } -} - .visEditor__resizer-isHidden { display: none; } @@ -68,15 +42,14 @@ * Canvas area */ +.visEditor__visualization__wrapper-expanded { + width: 100% !important; +} + .visEditor__visualization { display: flex; flex: 1 1 auto; // Fixes IE bug: the editor overflows a visualization on small screens overflow: hidden; - - @include euiBreakpoint('xs', 's', 'm') { - // If we are on a small screen we force the visualization to take 100% width. - width: 100% !important; - } } .visEditor__canvas { @@ -92,13 +65,34 @@ flex-basis: 100%; } - .visualize { - display: flex; - flex-direction: column; - flex: 1 1 100%; - } - .visChart { position: relative; } } + +/** + * If we are on a small screen we change the editor layout + */ +@include euiBreakpoint('xs', 's', 'm') { + .visEditor--default { + flex-direction: column; // change the editor direction to column + } + + .visEditor__collapsibleSidebar { + width: 100% !important; // force the editor to take 100% width + } + + .visEditor__collapsibleSidebar-isClosed { + height: $euiSizeXXL !important; // Just enough room for the collapse button + } + + .visEditor__resizer { + display: none; // hide the resizer button + } + + .visEditor__visualization__wrapper { + // force the visualization to take 100% width and height. + width: 100% !important; + height: 100% !important; + } +} diff --git a/src/plugins/vis_default_editor/public/_sidebar.scss b/src/plugins/vis_default_editor/public/_sidebar.scss index 23241abcff770e..0586b6809bcc00 100644 --- a/src/plugins/vis_default_editor/public/_sidebar.scss +++ b/src/plugins/vis_default_editor/public/_sidebar.scss @@ -3,11 +3,11 @@ // .visEditorSidebar { - min-width: $visEditorSidebarMinWidth; + height: 100%; + padding-left: $euiSizeS; - // a hack for IE, issue: https://github.com/elastic/kibana/issues/66586 - > .visEditorSidebar__formWrapper { - flex-basis: auto; + @include euiBreakpoint('xs', 's', 'm') { + padding-left: 0; } } diff --git a/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx b/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx index 294cdc508c325e..52d8109b352a13 100644 --- a/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx @@ -6,7 +6,14 @@ * Side Public License, v 1. */ -import React, { useMemo, useState, useCallback, KeyboardEventHandler, useEffect } from 'react'; +import React, { + memo, + useMemo, + useState, + useCallback, + KeyboardEventHandler, + useEffect, +} from 'react'; import { isEqual } from 'lodash'; import { i18n } from '@kbn/i18n'; import { keys, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; @@ -39,7 +46,7 @@ interface DefaultEditorSideBarProps { timeRange: TimeRange; } -function DefaultEditorSideBar({ +function DefaultEditorSideBarComponent({ embeddableHandler, isCollapsed, onClickCollapse, @@ -173,7 +180,7 @@ function DefaultEditorSideBar({ gutterSize="none" responsive={false} > - +
!value); }, []); + /** + * The empty callback is in place to prevent resetting the dragging state of the resize button. + * The mouseLeave is triggered since a visualization is rendered through another call of "ReactDOM.render()"" in expressions, + * using the "visRef" node reference. + * Here is the existing React issue: https://github.com/facebook/react/issues/17064 + */ + const onEditorMouseLeave = useCallback(() => {}, []); + useEffect(() => { if (!visRef.current) { return; @@ -79,35 +88,52 @@ function DefaultEditor({ ...core, }} > - - -
- - - - - - + + {(EuiResizablePanel, EuiResizableButton) => ( + <> + +
+ + + + + + + + + )} + ); diff --git a/src/plugins/vis_default_editor/public/index.scss b/src/plugins/vis_default_editor/public/index.scss index 8f2675c1ba374c..e97c6224a1dd90 100644 --- a/src/plugins/vis_default_editor/public/index.scss +++ b/src/plugins/vis_default_editor/public/index.scss @@ -1,5 +1,3 @@ -$visEditorSidebarMinWidth: 350px; - // Main layout @import './default'; @import './sidebar'; diff --git a/test/functional/page_objects/visualize_editor_page.ts b/test/functional/page_objects/visualize_editor_page.ts index beacfe30351a4b..5f05d825dd0f45 100644 --- a/test/functional/page_objects/visualize_editor_page.ts +++ b/test/functional/page_objects/visualize_editor_page.ts @@ -296,7 +296,7 @@ export function VisualizeEditorPageProvider({ getService, getPageObjects }: FtrP } public async sizeUpEditor() { - const resizerPanel = await testSubjects.find('splitPanelResizer'); + const resizerPanel = await testSubjects.find('euiResizableButton'); // Drag panel 100 px left await browser.dragAndDrop({ location: resizerPanel }, { location: { x: -100, y: 0 } }); } diff --git a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css index 35590df90fbb90..86183694330e28 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css +++ b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css @@ -55,7 +55,7 @@ discover-app .discover-table-footer { /* hide unusable controls * !important is required to override resizable panel inline display */ -.visEditor__content .visEditor--default > :not(.visEditor__visualization) { +.visEditor__content .visEditor--default > :not(.visEditor__visualization__wrapper) { display: none !important; } diff --git a/x-pack/plugins/reporting/server/lib/layouts/print.css b/x-pack/plugins/reporting/server/lib/layouts/print.css index c47c8de50f9e1c..fa963ac72ab41c 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/print.css +++ b/x-pack/plugins/reporting/server/lib/layouts/print.css @@ -54,7 +54,7 @@ discover-app .discover-table-footer { /* hide unusable controls * !important is required to override resizable panel inline display */ -.visEditor__content .visEditor--default > :not(.visEditor__visualization) { +.visEditor__content .visEditor--default > :not(.visEditor__visualization__wrapper) { display: none !important; } /** THIS IS FOR TSVB UNTIL REFACTOR **/