level 2 collapse
This commit is contained in:
parent
e6f025bf6e
commit
8e6800fd1e
6 changed files with 42 additions and 3 deletions
|
|
@ -73,6 +73,11 @@ const SettingsModalContent = {
|
||||||
return useInterfaceStore().layoutType === 'mobile'
|
return useInterfaceStore().layoutType === 'mobile'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
navCollapsed: false
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onOpen () {
|
onOpen () {
|
||||||
const targetTab = useInterfaceStore().settingsModalTargetTab
|
const targetTab = useInterfaceStore().settingsModalTargetTab
|
||||||
|
|
@ -90,9 +95,11 @@ const SettingsModalContent = {
|
||||||
useInterfaceStore().clearSettingsModalTargetTab()
|
useInterfaceStore().clearSettingsModalTargetTab()
|
||||||
},
|
},
|
||||||
nestedTooBig () {
|
nestedTooBig () {
|
||||||
|
this.navCollapsed = false
|
||||||
this.$refs.tabSwitcher.showNav()
|
this.$refs.tabSwitcher.showNav()
|
||||||
},
|
},
|
||||||
nestedTooSmall () {
|
nestedTooSmall () {
|
||||||
|
this.navCollapsed = true
|
||||||
this.$refs.tabSwitcher.hideNav()
|
this.$refs.tabSwitcher.hideNav()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
>
|
>
|
||||||
<GeneralTab
|
<GeneralTab
|
||||||
class="inner-tab -middle"
|
class="inner-tab -middle"
|
||||||
|
:parent-collapsed="navCollapsed"
|
||||||
@too-small="() => nestedTooSmall()"
|
@too-small="() => nestedTooSmall()"
|
||||||
@too-big="() => nestedTooBig()"
|
@too-big="() => nestedTooBig()"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@ library.add(
|
||||||
)
|
)
|
||||||
|
|
||||||
const GeneralTab = {
|
const GeneralTab = {
|
||||||
|
props: {
|
||||||
|
parentCollapsed: {
|
||||||
|
required: true,
|
||||||
|
type: Boolean
|
||||||
|
}
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({
|
subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
:label="$t('settings.general')"
|
:label="$t('settings.general')"
|
||||||
ref="tabSwitcher"
|
ref="tabSwitcher"
|
||||||
class="settings_tab-switcher"
|
class="settings_tab-switcher"
|
||||||
|
:parent-collapsed="parentCollapsed"
|
||||||
@too-small="() => $emit('tooSmall')"
|
@too-small="() => $emit('tooSmall')"
|
||||||
@too-big="() => $emit('tooBig')"
|
@too-big="() => $emit('tooBig')"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,11 @@ export default {
|
||||||
required: false,
|
required: false,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
parentCollapsed: {
|
||||||
|
required: false,
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['tooBig', 'tooSmall'],
|
emits: ['tooBig', 'tooSmall'],
|
||||||
|
|
@ -91,11 +96,18 @@ export default {
|
||||||
const navWidth = this.$refs.nav?.clientWidth
|
const navWidth = this.$refs.nav?.clientWidth
|
||||||
const contentsWidth = this.$refs.contents?.clientWidth
|
const contentsWidth = this.$refs.contents?.clientWidth
|
||||||
|
|
||||||
|
|
||||||
if (contentsWidth < tabContentWidth) {
|
if (contentsWidth < tabContentWidth) {
|
||||||
|
if (this.parentCollapsed) {
|
||||||
|
this.hideNav()
|
||||||
|
} else {
|
||||||
this.$emit('tooSmall')
|
this.$emit('tooSmall')
|
||||||
|
}
|
||||||
} else if (contentsWidth - navWidth >= tabContentWidth){
|
} else if (contentsWidth - navWidth >= tabContentWidth){
|
||||||
|
if (this.parentCollapsed) {
|
||||||
this.$emit('tooBig')
|
this.$emit('tooBig')
|
||||||
|
} else {
|
||||||
|
this.showNav()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// DO NOT put it to computed, it doesn't work (caching?)
|
// DO NOT put it to computed, it doesn't work (caching?)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
.tab-content-label {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
.tab-content {
|
.tab-content {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
|
||||||
|
|
@ -77,6 +81,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.-nav-content {
|
&.-nav-content {
|
||||||
|
> .contents {
|
||||||
|
> .tab-content-wrapper {
|
||||||
|
> .tab-content-label {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
> .tabs {
|
> .tabs {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue