Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested Flexible Layout direction problem #7637

Merged
merged 7 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/plugins/flexibleLayout/components/ContainerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
@object-drop-to="moveOrCreateNewFrame"
/>

<div role="row" class="c-fl-container__frames-holder">
<div
role="row"
class="c-fl-container__frames-holder"
:class="[rowsLayout ? '--layout-rows' : '--layout-cols']"
charlesh88 marked this conversation as resolved.
Show resolved Hide resolved
>
<template v-for="(frame, i) in frames" :key="frame.id">
<frame-component
class="c-fl-container__frame"
Expand Down
14 changes: 2 additions & 12 deletions src/plugins/flexibleLayout/components/FlexibleLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@

<div
class="c-fl__container-holder u-style-receiver js-style-receiver"
:class="{
'c-fl--rows': rowsLayout === true
}"
:aria-label="`Flexible Layout ${rowsLayout ? 'Row' : 'Column'}`"
:class="[rowsLayout ? 'c-fl--rows' : 'c-fl--cols']"
:aria-label="`Flexible Layout ${rowsLayout ? 'Rows' : 'Columns'}`"
charlesh88 marked this conversation as resolved.
Show resolved Hide resolved
>
<template v-for="(container, index) in containers" :key="`component-${container.id}`">
<drop-hint
Expand All @@ -45,7 +43,6 @@
/>

<container-component
class="c-fl__container"
:index="index"
:container="container"
:rows-layout="rowsLayout"
Expand Down Expand Up @@ -148,13 +145,6 @@ export default {
};
},
computed: {
layoutDirectionStr() {
if (this.rowsLayout) {
return 'Rows';
} else {
return 'Columns';
}
},
allContainersAreEmpty() {
return this.containers.every((container) => container.frames.length === 0);
}
Expand Down
30 changes: 20 additions & 10 deletions src/plugins/flexibleLayout/components/flexible-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
$majorOffset: 35%;
content: '';
display: block;
position: absolute;
@include grippy($c: $editFrameSelectedMovebarColorFg, $dir: $dir);
@if $dir == 'x' {
top: $minorOffset;
Expand All @@ -30,23 +29,26 @@
flex: 0 0 auto;
}

&--cols {
}

&--rows {
}
charlesh88 marked this conversation as resolved.
Show resolved Hide resolved

&__container-holder {
display: flex;
flex: 1 1 100%; // Must be 100% to work
overflow: auto;

// Columns by default
flex-direction: row;
> * + * {
margin-left: 1px;
// Controls layout of c-fl__container(s)
&[class*='--cols'] {
flex-direction: row;
column-gap: 1px;
}

&[class*='--rows'] {
flex-direction: column;
> * + * {
margin-left: 0;
margin-top: 1px;
}
row-gap: 1px;
}
}

Expand Down Expand Up @@ -119,10 +121,18 @@
&__frames-holder {
display: flex;
flex: 1 1 100%; // Must be 100% to work
flex-direction: column; // Default
flex-direction: row; // Default
align-content: stretch;
align-items: stretch;
overflow: hidden; // This sucks, but doing in the short-term

&.--layout-cols {
flex-direction: column !important;
}

&.--layout-rows {
flex-direction: row !important;
}
}

.is-editing & {
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/flexibleLayout/toolbarProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ function ToolbarProvider(openmct) {
options: [
{
value: true,
icon: 'icon-columns',
title: 'Columns layout'
icon: 'icon-rows',
title: 'Switch to rows layout'
},
{
value: false,
icon: 'icon-rows',
title: 'Rows layout'
icon: 'icon-columns',
title: 'Switch to columns layout'
charlesh88 marked this conversation as resolved.
Show resolved Hide resolved
}
]
};
Expand Down
Loading