This commit is contained in:
syuilo 2018-06-08 05:48:27 +09:00
parent af9c5c6ab7
commit af501f5eeb
5 changed files with 71 additions and 31 deletions

View file

@ -1,10 +1,10 @@
<template> <template>
<x-widgets-column v-if="column.type == 'widgets'"/> <x-widgets-column v-if="column.type == 'widgets'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
<x-notifications-column v-else-if="column.type == 'notifications'"/> <x-notifications-column v-else-if="column.type == 'notifications'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
<x-tl-column v-else-if="column.type == 'home'"/> <x-tl-column v-else-if="column.type == 'home'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
<x-tl-column v-else-if="column.type == 'local'"/> <x-tl-column v-else-if="column.type == 'local'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
<x-tl-column v-else-if="column.type == 'global'"/> <x-tl-column v-else-if="column.type == 'global'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
<x-tl-column v-else-if="column.type == 'list'"/> <x-tl-column v-else-if="column.type == 'list'" :column="column" :is-stacked="isStacked" :is-active="isActive"/>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -35,14 +35,6 @@ export default Vue.extend({
required: false, required: false,
default: true default: true
} }
},
provide() {
return {
column: this.column,
isStacked: this.isStacked,
isActive: this.isActive
};
} }
}); });
</script> </script>

View file

@ -1,11 +1,11 @@
<template> <template>
<div class="dnpfarvgbnfmyzbdquhhzyxcmstpdqzs" :class="{ naked, narrow, isActive, isStacked }"> <div class="dnpfarvgbnfmyzbdquhhzyxcmstpdqzs" :class="{ naked, narrow, active, isStacked }">
<header :class="{ indicate: count > 0 }" @click="toggleActive"> <header :class="{ indicate: count > 0 }" @click="toggleActive">
<slot name="header"></slot> <slot name="header"></slot>
<span class="count" v-if="count > 0">({{ count }})</span> <span class="count" v-if="count > 0">({{ count }})</span>
<button ref="menu" @click.stop="showMenu">%fa:caret-down%</button> <button ref="menu" @click.stop="showMenu">%fa:caret-down%</button>
</header> </header>
<div ref="body" v-show="isActive"> <div ref="body" v-show="active">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
@ -17,6 +17,18 @@ import Menu from '../../../../common/views/components/menu.vue';
export default Vue.extend({ export default Vue.extend({
props: { props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
},
isActive: {
type: Boolean,
required: true
},
name: { name: {
type: String, type: String,
required: false required: false
@ -39,21 +51,18 @@ export default Vue.extend({
}, },
inject: { inject: {
column: { from: 'column' },
_isActive: { from: 'isActive' },
isStacked: { from: 'isStacked' },
getColumnVm: { from: 'getColumnVm' } getColumnVm: { from: 'getColumnVm' }
}, },
data() { data() {
return { return {
count: 0, count: 0,
isActive: this._isActive active: this.isActive
}; };
}, },
watch: { watch: {
isActive(v) { active(v) {
if (v && this.isScrollTop()) { if (v && this.isScrollTop()) {
this.$emit('top'); this.$emit('top');
} }
@ -79,12 +88,12 @@ export default Vue.extend({
toggleActive() { toggleActive() {
if (!this.isStacked) return; if (!this.isStacked) return;
const vms = this.$store.state.settings.deck.layout.find(ids => ids.indexOf(this.column.id) != -1).map(id => this.getColumnVm(id)); const vms = this.$store.state.settings.deck.layout.find(ids => ids.indexOf(this.column.id) != -1).map(id => this.getColumnVm(id));
if (this.isActive && vms.filter(vm => vm.$el.classList.contains('isActive')).length == 1) return; if (this.active && vms.filter(vm => vm.$el.classList.contains('active')).length == 1) return;
this.isActive = !this.isActive; this.active = !this.active;
}, },
isScrollTop() { isScrollTop() {
return this.isActive && this.$refs.body.scrollTop == 0; return this.active && this.$refs.body.scrollTop == 0;
}, },
onScroll() { onScroll() {
@ -176,7 +185,7 @@ root(isDark)
box-shadow 0 2px 16px rgba(#000, 0.1) box-shadow 0 2px 16px rgba(#000, 0.1)
overflow hidden overflow hidden
&:not(.isActive) &:not(.active)
flex-basis $header-height flex-basis $header-height
min-height $header-height min-height $header-height

View file

@ -1,5 +1,5 @@
<template> <template>
<x-column :name="name"> <x-column :name="name" :column="column" :is-stacked="isStacked" :is-active="isActive">
<span slot="header">%fa:bell R%{{ name }}</span> <span slot="header">%fa:bell R%{{ name }}</span>
<x-notifications/> <x-notifications/>
@ -17,7 +17,20 @@ export default Vue.extend({
XNotifications XNotifications
}, },
inject: ['column'], props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
},
isActive: {
type: Boolean,
required: true
}
},
computed: { computed: {
name(): string { name(): string {

View file

@ -1,5 +1,5 @@
<template> <template>
<x-column :menu="menu" :name="name"> <x-column :menu="menu" :name="name" :column="column" :is-stacked="isStacked" :is-active="isActive">
<span slot="header"> <span slot="header">
<template v-if="column.type == 'home'">%fa:home%</template> <template v-if="column.type == 'home'">%fa:home%</template>
<template v-if="column.type == 'local'">%fa:R comments%</template> <template v-if="column.type == 'local'">%fa:R comments%</template>
@ -30,7 +30,20 @@ export default Vue.extend({
XListTl XListTl
}, },
inject: ['column'], props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
},
isActive: {
type: Boolean,
required: true
}
},
data() { data() {
return { return {

View file

@ -1,5 +1,5 @@
<template> <template>
<x-column :menu="menu" :naked="true" :narrow="true" :name="name" class="wtdtxvecapixsepjtcupubtsmometobz"> <x-column :menu="menu" :naked="true" :narrow="true" :name="name" :column="column" :is-stacked="isStacked" :is-active="isActive" class="wtdtxvecapixsepjtcupubtsmometobz">
<span slot="header">%fa:calculator%{{ name }}</span> <span slot="header">%fa:calculator%{{ name }}</span>
<div class="gqpwvtwtprsbmnssnbicggtwqhmylhnq"> <div class="gqpwvtwtprsbmnssnbicggtwqhmylhnq">
@ -64,7 +64,20 @@ export default Vue.extend({
XDraggable XDraggable
}, },
inject: ['column'], props: {
column: {
type: Object,
required: true
},
isStacked: {
type: Boolean,
required: true
},
isActive: {
type: Boolean,
required: true
}
},
data() { data() {
return { return {