* wip
* wip
* Clean up
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* 🎨
* wip
* wip
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<div class="dnpfarvgbnfmyzbdquhhzyxcmstpdqzs" :class="{ naked, narrow, active, isStacked, draghover, dragging, dropready }"
|
||||
@dragover.prevent.stop="onDragover"
|
||||
@dragenter.prevent="onDragenter"
|
||||
@dragleave="onDragleave"
|
||||
@drop.prevent.stop="onDrop">
|
||||
<header :class="{ indicate: count > 0 }"
|
||||
@ -16,7 +15,8 @@
|
||||
</button>
|
||||
<slot name="header"></slot>
|
||||
<span class="count" v-if="count > 0">({{ count }})</span>
|
||||
<button class="menu" ref="menu" @click.stop="showMenu">%fa:caret-down%</button>
|
||||
<button v-if="!isTemporaryColumn" class="menu" ref="menu" @click.stop="showMenu">%fa:caret-down%</button>
|
||||
<button v-else class="close" @click.stop="close">%fa:times%</button>
|
||||
</header>
|
||||
<div ref="body" v-show="active">
|
||||
<slot></slot>
|
||||
@ -34,11 +34,13 @@ export default Vue.extend({
|
||||
props: {
|
||||
column: {
|
||||
type: Object,
|
||||
required: true
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
isStacked: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
@ -61,6 +63,12 @@ export default Vue.extend({
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
isTemporaryColumn(): boolean {
|
||||
return this.column == null;
|
||||
}
|
||||
},
|
||||
|
||||
inject: {
|
||||
getColumnVm: { from: 'getColumnVm' }
|
||||
},
|
||||
@ -96,14 +104,20 @@ export default Vue.extend({
|
||||
|
||||
mounted() {
|
||||
this.$refs.body.addEventListener('scroll', this.onScroll, { passive: true });
|
||||
this.$root.$on('deck.column.dragStart', this.onOtherDragStart);
|
||||
this.$root.$on('deck.column.dragEnd', this.onOtherDragEnd);
|
||||
|
||||
if (!this.isTemporaryColumn) {
|
||||
this.$root.$on('deck.column.dragStart', this.onOtherDragStart);
|
||||
this.$root.$on('deck.column.dragEnd', this.onOtherDragEnd);
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.$refs.body.removeEventListener('scroll', this.onScroll);
|
||||
this.$root.$off('deck.column.dragStart', this.onOtherDragStart);
|
||||
this.$root.$off('deck.column.dragEnd', this.onOtherDragEnd);
|
||||
|
||||
if (!this.isTemporaryColumn) {
|
||||
this.$root.$off('deck.column.dragStart', this.onOtherDragStart);
|
||||
this.$root.$off('deck.column.dragEnd', this.onOtherDragEnd);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -203,6 +217,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onContextmenu(e) {
|
||||
if (this.isTemporaryColumn) return;
|
||||
contextmenu((this as any).os)(e, this.getMenu());
|
||||
},
|
||||
|
||||
@ -214,6 +229,13 @@ export default Vue.extend({
|
||||
});
|
||||
},
|
||||
|
||||
close() {
|
||||
this.$store.commit('device/set', {
|
||||
key: 'deckTemporaryColumn',
|
||||
value: null
|
||||
});
|
||||
},
|
||||
|
||||
goTop() {
|
||||
this.$refs.body.scrollTo({
|
||||
top: 0,
|
||||
@ -222,6 +244,12 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onDragstart(e) {
|
||||
// テンポラリカラムはドラッグさせない
|
||||
if (this.isTemporaryColumn) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('mk-deck-column', this.column.id);
|
||||
this.dragging = true;
|
||||
@ -232,6 +260,12 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
onDragover(e) {
|
||||
// テンポラリカラムにはドロップさせない
|
||||
if (this.isTemporaryColumn) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
// 自分自身がドラッグされている場合
|
||||
if (this.dragging) {
|
||||
// 自分自身にはドロップさせない
|
||||
@ -242,9 +276,7 @@ export default Vue.extend({
|
||||
const isDeckColumn = e.dataTransfer.types[0] == 'mk-deck-column';
|
||||
|
||||
e.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none';
|
||||
},
|
||||
|
||||
onDragenter() {
|
||||
if (!this.dragging) this.draghover = true;
|
||||
},
|
||||
|
||||
@ -349,6 +381,7 @@ export default Vue.extend({
|
||||
|
||||
> .toggleActive
|
||||
> .menu
|
||||
> .close
|
||||
padding 0
|
||||
width $header-height
|
||||
line-height $header-height
|
||||
@ -365,6 +398,7 @@ export default Vue.extend({
|
||||
margin-left -16px
|
||||
|
||||
> .menu
|
||||
> .close
|
||||
margin-left auto
|
||||
margin-right -16px
|
||||
|
||||
|
Reference in New Issue
Block a user