2018-06-05 06:36:21 -06:00
|
|
|
<template>
|
|
|
|
<mk-ui :class="$style.root">
|
2018-06-05 13:00:48 -06:00
|
|
|
<div class="qlvquzbjribqcaozciifydkngcwtyzje" :data-darkmode="$store.state.device.darkmode">
|
2018-06-07 13:21:06 -06:00
|
|
|
<template v-for="ids in layout">
|
|
|
|
<div v-if="ids.length > 1" class="folder">
|
|
|
|
<template v-for="id, i in ids">
|
2018-06-07 16:43:12 -06:00
|
|
|
<x-column-core :ref="id" :key="id" :column="columns.find(c => c.id == id)" :is-stacked="true"/>
|
2018-06-07 13:21:06 -06:00
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<x-column-core v-else :ref="ids[0]" :key="ids[0]" :column="columns.find(c => c.id == ids[0])"/>
|
2018-06-05 12:12:06 -06:00
|
|
|
</template>
|
2018-06-06 10:17:29 -06:00
|
|
|
<button ref="add" @click="add" title="%i18n:common.deck.add-column%">%fa:plus%</button>
|
2018-06-05 06:36:21 -06:00
|
|
|
</div>
|
|
|
|
</mk-ui>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-06-07 13:21:06 -06:00
|
|
|
import XColumnCore from './deck.column-core.vue';
|
2018-06-05 14:18:08 -06:00
|
|
|
import Menu from '../../../../common/views/components/menu.vue';
|
|
|
|
import MkUserListsWindow from '../../components/user-lists-window.vue';
|
2018-06-05 12:12:06 -06:00
|
|
|
import * as uuid from 'uuid';
|
2018-06-05 06:36:21 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
2018-06-07 13:21:06 -06:00
|
|
|
XColumnCore
|
2018-06-05 12:12:06 -06:00
|
|
|
},
|
2018-06-06 10:00:38 -06:00
|
|
|
|
2018-06-05 12:12:06 -06:00
|
|
|
computed: {
|
2018-06-07 13:21:06 -06:00
|
|
|
columns(): any[] {
|
2018-06-05 12:12:06 -06:00
|
|
|
if (this.$store.state.settings.deck == null) return [];
|
|
|
|
return this.$store.state.settings.deck.columns;
|
2018-06-07 13:21:06 -06:00
|
|
|
},
|
|
|
|
layout(): any[] {
|
|
|
|
if (this.$store.state.settings.deck == null) return [];
|
|
|
|
if (this.$store.state.settings.deck.layout == null) return this.$store.state.settings.deck.columns.map(c => [c.id]);
|
|
|
|
return this.$store.state.settings.deck.layout;
|
2018-06-05 12:12:06 -06:00
|
|
|
}
|
|
|
|
},
|
2018-06-06 10:00:38 -06:00
|
|
|
|
2018-06-07 13:21:06 -06:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
getColumnVm: this.getColumnVm
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2018-06-05 12:12:06 -06:00
|
|
|
created() {
|
|
|
|
if (this.$store.state.settings.deck == null) {
|
|
|
|
const deck = {
|
|
|
|
columns: [/*{
|
|
|
|
type: 'widgets',
|
|
|
|
widgets: []
|
|
|
|
}, */{
|
|
|
|
id: uuid(),
|
|
|
|
type: 'home'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'notifications'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'local'
|
|
|
|
}, {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'global'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
2018-06-07 13:21:06 -06:00
|
|
|
deck.layout = deck.columns.map(c => [c.id]);
|
|
|
|
|
2018-06-05 12:12:06 -06:00
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'deck',
|
|
|
|
value: deck
|
|
|
|
});
|
|
|
|
}
|
2018-06-07 13:21:06 -06:00
|
|
|
|
|
|
|
// 互換性のため
|
|
|
|
if (this.$store.state.settings.deck != null && this.$store.state.settings.deck.layout == null) {
|
|
|
|
this.$store.dispatch('settings/set', {
|
|
|
|
key: 'deck',
|
|
|
|
value: Object.assign({}, this.$store.state.settings.deck, {
|
|
|
|
layout: this.$store.state.settings.deck.columns.map(c => [c.id])
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
2018-06-05 14:18:08 -06:00
|
|
|
},
|
|
|
|
|
2018-06-06 10:00:38 -06:00
|
|
|
mounted() {
|
|
|
|
document.documentElement.style.overflow = 'hidden';
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
document.documentElement.style.overflow = 'auto';
|
|
|
|
},
|
|
|
|
|
2018-06-05 14:18:08 -06:00
|
|
|
methods: {
|
2018-06-07 13:21:06 -06:00
|
|
|
getColumnVm(id) {
|
|
|
|
return this.$refs[id][0];
|
|
|
|
},
|
|
|
|
|
2018-06-05 14:18:08 -06:00
|
|
|
add() {
|
|
|
|
this.os.new(Menu, {
|
|
|
|
source: this.$refs.add,
|
|
|
|
compact: true,
|
|
|
|
items: [{
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.home%',
|
2018-06-05 14:18:08 -06:00
|
|
|
onClick: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'home'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.local%',
|
2018-06-05 14:18:08 -06:00
|
|
|
onClick: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'local'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.global%',
|
2018-06-05 14:18:08 -06:00
|
|
|
onClick: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'global'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.list%',
|
2018-06-05 14:18:08 -06:00
|
|
|
onClick: () => {
|
|
|
|
const w = (this as any).os.new(MkUserListsWindow);
|
|
|
|
w.$once('choosen', list => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'list',
|
|
|
|
list: list
|
|
|
|
});
|
|
|
|
w.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.notifications%',
|
2018-06-05 14:18:08 -06:00
|
|
|
onClick: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'notifications'
|
|
|
|
});
|
|
|
|
}
|
2018-06-06 04:22:45 -06:00
|
|
|
}, {
|
2018-06-06 10:17:29 -06:00
|
|
|
content: '%i18n:common.deck.widgets%',
|
2018-06-06 04:22:45 -06:00
|
|
|
onClick: () => {
|
|
|
|
this.$store.dispatch('settings/addDeckColumn', {
|
|
|
|
id: uuid(),
|
|
|
|
type: 'widgets',
|
|
|
|
widgets: []
|
|
|
|
});
|
|
|
|
}
|
2018-06-05 14:18:08 -06:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
}
|
2018-06-05 06:36:21 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
|
|
|
.root
|
|
|
|
height 100vh
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
@import '~const.styl'
|
|
|
|
|
|
|
|
root(isDark)
|
|
|
|
display flex
|
|
|
|
flex 1
|
2018-06-05 06:44:02 -06:00
|
|
|
padding 16px 0 16px 16px
|
|
|
|
overflow auto
|
2018-06-05 06:36:21 -06:00
|
|
|
|
2018-06-05 13:00:48 -06:00
|
|
|
> div
|
2018-06-06 10:17:29 -06:00
|
|
|
margin-right 8px
|
2018-06-05 13:00:48 -06:00
|
|
|
|
|
|
|
&:last-of-type
|
|
|
|
margin-right 0
|
|
|
|
|
2018-06-07 13:21:06 -06:00
|
|
|
&.folder
|
|
|
|
display flex
|
|
|
|
flex-direction column
|
|
|
|
|
|
|
|
> *:not(:last-child)
|
|
|
|
margin-bottom 8px
|
|
|
|
|
2018-06-06 14:14:37 -06:00
|
|
|
> *
|
|
|
|
&:first-child
|
|
|
|
margin-left auto
|
|
|
|
|
|
|
|
&:last-child
|
|
|
|
margin-right auto
|
|
|
|
|
2018-06-05 13:00:48 -06:00
|
|
|
> button
|
|
|
|
padding 0 16px
|
|
|
|
color isDark ? #93a0a5 : #888
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
color isDark ? #b8c5ca : #777
|
|
|
|
|
|
|
|
&:active
|
|
|
|
color isDark ? #fff : #555
|
|
|
|
|
2018-06-05 06:36:21 -06:00
|
|
|
.qlvquzbjribqcaozciifydkngcwtyzje[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.qlvquzbjribqcaozciifydkngcwtyzje:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
|
|
|
</style>
|