2018-06-06 13:22:45 +03:00
|
|
|
<template>
|
2018-06-08 01:43:12 +03:00
|
|
|
<x-column :menu="menu" :naked="true" :narrow="true" :name="name" :column="column" :is-stacked="isStacked" class="wtdtxvecapixsepjtcupubtsmometobz">
|
2018-06-07 22:21:06 +03:00
|
|
|
<span slot="header">%fa:calculator%{{ name }}</span>
|
2018-06-06 13:22:45 +03:00
|
|
|
|
2018-06-07 22:21:06 +03:00
|
|
|
<div class="gqpwvtwtprsbmnssnbicggtwqhmylhnq">
|
|
|
|
<template v-if="edit">
|
|
|
|
<header>
|
2018-06-12 02:58:50 +03:00
|
|
|
<select v-model="widgetAdderSelected" @change="addWidget">
|
2018-06-07 22:21:06 +03:00
|
|
|
<option value="profile">%i18n:common.widgets.profile%</option>
|
|
|
|
<option value="analog-clock">%i18n:common.widgets.analog-clock%</option>
|
|
|
|
<option value="calendar">%i18n:common.widgets.calendar%</option>
|
|
|
|
<option value="timemachine">%i18n:common.widgets.timemachine%</option>
|
|
|
|
<option value="activity">%i18n:common.widgets.activity%</option>
|
|
|
|
<option value="rss">%i18n:common.widgets.rss%</option>
|
|
|
|
<option value="trends">%i18n:common.widgets.trends%</option>
|
|
|
|
<option value="photo-stream">%i18n:common.widgets.photo-stream%</option>
|
|
|
|
<option value="slideshow">%i18n:common.widgets.slideshow%</option>
|
|
|
|
<option value="version">%i18n:common.widgets.version%</option>
|
|
|
|
<option value="broadcast">%i18n:common.widgets.broadcast%</option>
|
|
|
|
<option value="notifications">%i18n:common.widgets.notifications%</option>
|
|
|
|
<option value="users">%i18n:common.widgets.users%</option>
|
|
|
|
<option value="polls">%i18n:common.widgets.polls%</option>
|
|
|
|
<option value="post-form">%i18n:common.widgets.post-form%</option>
|
|
|
|
<option value="messaging">%i18n:common.widgets.messaging%</option>
|
|
|
|
<option value="memo">%i18n:common.widgets.memo%</option>
|
2018-06-11 03:11:32 +03:00
|
|
|
<option value="hashtags">%i18n:common.widgets.hashtags%</option>
|
2018-06-08 22:14:26 +03:00
|
|
|
<option value="posts-monitor">%i18n:common.widgets.posts-monitor%</option>
|
2018-06-07 22:21:06 +03:00
|
|
|
<option value="server">%i18n:common.widgets.server%</option>
|
|
|
|
<option value="donation">%i18n:common.widgets.donation%</option>
|
|
|
|
<option value="nav">%i18n:common.widgets.nav%</option>
|
|
|
|
<option value="tips">%i18n:common.widgets.tips%</option>
|
|
|
|
</select>
|
|
|
|
</header>
|
|
|
|
<x-draggable
|
|
|
|
:list="column.widgets"
|
2018-06-12 02:58:50 +03:00
|
|
|
:options="{ animation: 150 }"
|
2018-06-07 22:21:06 +03:00
|
|
|
@sort="onWidgetSort"
|
|
|
|
>
|
2018-06-12 02:58:50 +03:00
|
|
|
<div v-for="widget in column.widgets" class="customize-container" :key="widget.id" @contextmenu.stop.prevent="widgetFunc(widget.id)">
|
|
|
|
<button class="remove" @click="removeWidget(widget)">%fa:times%</button>
|
|
|
|
<component :is="`mkw-${widget.name}`" :widget="widget" :ref="widget.id" :is-customize-mode="true" platform="deck"/>
|
2018-06-07 22:21:06 +03:00
|
|
|
</div>
|
|
|
|
</x-draggable>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<component class="widget" v-for="widget in column.widgets" :is="`mkw-${widget.name}`" :key="widget.id" :ref="widget.id" :widget="widget" platform="deck"/>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</x-column>
|
2018-06-06 13:22:45 +03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import XColumn from './deck.column.vue';
|
|
|
|
import * as XDraggable from 'vuedraggable';
|
|
|
|
import * as uuid from 'uuid';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
XColumn,
|
|
|
|
XDraggable
|
|
|
|
},
|
|
|
|
|
2018-06-07 23:48:27 +03:00
|
|
|
props: {
|
|
|
|
column: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
isStacked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
2018-06-06 13:22:45 +03:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
edit: false,
|
|
|
|
menu: null,
|
|
|
|
widgetAdderSelected: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-06-07 00:13:57 +03:00
|
|
|
computed: {
|
|
|
|
name(): string {
|
|
|
|
if (this.column.name) return this.column.name;
|
|
|
|
return '%i18n:common.deck.widgets%';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-06-06 13:22:45 +03:00
|
|
|
created() {
|
|
|
|
this.menu = [{
|
2018-06-08 05:46:45 +03:00
|
|
|
icon: '%fa:cog%',
|
|
|
|
text: '%i18n:@edit%',
|
|
|
|
action: () => {
|
2018-06-06 13:22:45 +03:00
|
|
|
this.edit = !this.edit;
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
widgetFunc(id) {
|
|
|
|
const w = this.$refs[id][0];
|
|
|
|
if (w.func) w.func();
|
|
|
|
},
|
|
|
|
|
|
|
|
onWidgetSort() {
|
|
|
|
this.saveWidgets();
|
|
|
|
},
|
|
|
|
|
|
|
|
addWidget() {
|
|
|
|
this.$store.dispatch('settings/addDeckWidget', {
|
|
|
|
id: this.column.id,
|
|
|
|
widget: {
|
|
|
|
name: this.widgetAdderSelected,
|
|
|
|
id: uuid(),
|
|
|
|
data: {}
|
|
|
|
}
|
|
|
|
});
|
2018-06-17 07:52:52 +03:00
|
|
|
|
|
|
|
this.widgetAdderSelected = null;
|
2018-06-06 13:22:45 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
removeWidget(widget) {
|
|
|
|
this.$store.dispatch('settings/removeDeckWidget', {
|
|
|
|
id: this.column.id,
|
|
|
|
widget
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
saveWidgets() {
|
|
|
|
this.$store.dispatch('settings/saveDeck');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
@import '~const.styl'
|
|
|
|
|
|
|
|
root(isDark)
|
|
|
|
.gqpwvtwtprsbmnssnbicggtwqhmylhnq
|
2018-06-12 02:58:50 +03:00
|
|
|
> header
|
|
|
|
padding 16px
|
|
|
|
|
|
|
|
> *
|
|
|
|
width 100%
|
|
|
|
padding 4px
|
|
|
|
|
2018-06-06 13:22:45 +03:00
|
|
|
.widget, .customize-container
|
|
|
|
margin 8px
|
|
|
|
|
|
|
|
&:first-of-type
|
|
|
|
margin-top 0
|
|
|
|
|
|
|
|
.customize-container
|
2018-06-12 02:58:50 +03:00
|
|
|
cursor move
|
|
|
|
|
|
|
|
> *:not(.remove)
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
> .remove
|
|
|
|
position absolute
|
|
|
|
z-index 1
|
|
|
|
top 8px
|
|
|
|
right 8px
|
|
|
|
width 32px
|
|
|
|
height 32px
|
|
|
|
color #fff
|
|
|
|
background rgba(#000, 0.7)
|
|
|
|
border-radius 4px
|
2018-06-06 13:22:45 +03:00
|
|
|
|
|
|
|
> header
|
|
|
|
color isDark ? #fff : #000
|
|
|
|
|
|
|
|
.wtdtxvecapixsepjtcupubtsmometobz[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.wtdtxvecapixsepjtcupubtsmometobz:not([data-darkmode])
|
|
|
|
root(false)
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|