parent
b4e5fe7e71
commit
af5b4749b0
@ -95,7 +95,7 @@ sensitive: "閲覧注意"
|
|||||||
add: "追加"
|
add: "追加"
|
||||||
reaction: "リアクション"
|
reaction: "リアクション"
|
||||||
reactionSettingDescription: "リアクションピッカーに表示するリアクションを設定します。"
|
reactionSettingDescription: "リアクションピッカーに表示するリアクションを設定します。"
|
||||||
reactionSettingDescription2: "ドラッグして並び替えます。クリックして削除します。"
|
reactionSettingDescription2: "ドラッグして並び替え、クリックして削除、+を押して追加します。"
|
||||||
rememberNoteVisibility: "公開範囲を記憶する"
|
rememberNoteVisibility: "公開範囲を記憶する"
|
||||||
attachCancel: "添付取り消し"
|
attachCancel: "添付取り消し"
|
||||||
markAsSensitive: "閲覧注意にする"
|
markAsSensitive: "閲覧注意にする"
|
||||||
|
@ -242,13 +242,13 @@
|
|||||||
"vanilla-tilt": "1.7.0",
|
"vanilla-tilt": "1.7.0",
|
||||||
"vue": "3.0.3",
|
"vue": "3.0.3",
|
||||||
"vue-color": "2.7.1",
|
"vue-color": "2.7.1",
|
||||||
"vue-draggable-next": "1.0.8",
|
|
||||||
"vue-i18n": "9.0.0-beta.7",
|
"vue-i18n": "9.0.0-beta.7",
|
||||||
"vue-json-pretty": "1.7.1",
|
"vue-json-pretty": "1.7.1",
|
||||||
"vue-loader": "16.0.0",
|
"vue-loader": "16.0.0",
|
||||||
"vue-prism-editor": "2.0.0-alpha.2",
|
"vue-prism-editor": "2.0.0-alpha.2",
|
||||||
"vue-router": "4.0.0-rc.6",
|
"vue-router": "4.0.0-rc.6",
|
||||||
"vue-style-loader": "4.1.2",
|
"vue-style-loader": "4.1.2",
|
||||||
|
"vuedraggable": "4.0.1",
|
||||||
"vuex": "4.0.0-rc.2",
|
"vuex": "4.0.0-rc.2",
|
||||||
"vuex-persistedstate": "3.1.0",
|
"vuex-persistedstate": "3.1.0",
|
||||||
"web-push": "3.4.4",
|
"web-push": "3.4.4",
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="skeikyzd" v-show="files.length != 0">
|
<div class="skeikyzd" v-show="files.length != 0">
|
||||||
<XDraggable class="files" :list="files" animation="150" delay="100" delay-on-touch-only="true">
|
<XDraggable class="files" v-model="_files" item-key="id" animation="150" delay="100" delay-on-touch-only="true">
|
||||||
<div v-for="file in files" :key="file.id" @click="showFileMenu(file, $event)" @contextmenu.prevent="showFileMenu(file, $event)">
|
<template #item="{element}">
|
||||||
<MkDriveFileThumbnail :data-id="file.id" class="thumbnail" :file="file" fit="cover"/>
|
<div @click="showFileMenu(element, $event)" @contextmenu.prevent="showFileMenu(element, $event)">
|
||||||
<div class="sensitive" v-if="file.isSensitive">
|
<MkDriveFileThumbnail :data-id="element.id" class="thumbnail" :file="element" fit="cover"/>
|
||||||
<Fa class="icon" :icon="faExclamationTriangle"/>
|
<div class="sensitive" v-if="element.isSensitive">
|
||||||
|
<Fa class="icon" :icon="faExclamationTriangle"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
<p class="remain">{{ 4 - files.length }}/4</p>
|
<p class="remain">{{ 4 - files.length }}/4</p>
|
||||||
</div>
|
</div>
|
||||||
@ -21,7 +23,7 @@ import * as os from '@/os';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XDraggable: defineAsyncComponent(() => import('vue-draggable-next').then(x => x.VueDraggableNext)),
|
XDraggable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)),
|
||||||
MkDriveFileThumbnail
|
MkDriveFileThumbnail
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['updated', 'detach'],
|
emits: ['updated', 'detach', 'changeSensitive', 'changeName'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -46,6 +48,17 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
_files: {
|
||||||
|
get() {
|
||||||
|
return this.files;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit('updated', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
detachMedia(id) {
|
detachMedia(id) {
|
||||||
if (this.detachMediaFn) {
|
if (this.detachMediaFn) {
|
||||||
@ -59,8 +72,7 @@ export default defineComponent({
|
|||||||
fileId: file.id,
|
fileId: file.id,
|
||||||
isSensitive: !file.isSensitive
|
isSensitive: !file.isSensitive
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
file.isSensitive = !file.isSensitive;
|
this.$emit('changeSensitive', file, !file.isSensitive);
|
||||||
this.$emit('updated', file);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async rename(file) {
|
async rename(file) {
|
||||||
@ -76,8 +88,8 @@ export default defineComponent({
|
|||||||
fileId: file.id,
|
fileId: file.id,
|
||||||
name: result
|
name: result
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
this.$emit('changeName', file, result);
|
||||||
file.name = result;
|
file.name = result;
|
||||||
this.$emit('updated', file);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
showFileMenu(file, ev: MouseEvent) {
|
showFileMenu(file, ev: MouseEvent) {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$t('annotation')" @keydown="onKeydown">
|
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$t('annotation')" @keydown="onKeydown">
|
||||||
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste"></textarea>
|
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste"></textarea>
|
||||||
<XPostFormAttaches class="attaches" :files="files" @updated="updateMedia" @detach="detachMedia"/>
|
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
|
||||||
<XPollEditor v-if="poll" :poll="poll" @destroyed="poll = null" @updated="onPollUpdate"/>
|
<XPollEditor v-if="poll" :poll="poll" @destroyed="poll = null" @updated="onPollUpdate"/>
|
||||||
<footer>
|
<footer>
|
||||||
<button class="_button" @click="chooseFileFrom" v-tooltip="$t('attachFile')"><Fa :icon="faPhotoVideo"/></button>
|
<button class="_button" @click="chooseFileFrom" v-tooltip="$t('attachFile')"><Fa :icon="faPhotoVideo"/></button>
|
||||||
@ -359,12 +359,20 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
detachMedia(id) {
|
detachFile(id) {
|
||||||
this.files = this.files.filter(x => x.id != id);
|
this.files = this.files.filter(x => x.id != id);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateMedia(file) {
|
updateFiles(files) {
|
||||||
this.files[this.files.findIndex(x => x.id === file.id)] = file;
|
this.files = files;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateFileSensitive(file, sensitive) {
|
||||||
|
this.files[this.files.findIndex(x => x.id === file.id)].isSensitive = sensitive;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateFileName(file, name) {
|
||||||
|
this.files[this.files.findIndex(x => x.id === file.id)].name = name;
|
||||||
},
|
},
|
||||||
|
|
||||||
upload(file: File, name?: string) {
|
upload(file: File, name?: string) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<XDraggable tag="div" :list="blocks" handle=".drag-handle" :group="{ name: 'blocks' }" animation="150" swap-threshold="0.5">
|
<XDraggable tag="div" v-model="blocks" item-key="id" handle=".drag-handle" :group="{ name: 'blocks' }" animation="150" swap-threshold="0.5">
|
||||||
<component v-for="block in blocks" :is="'x-' + block.type" :value="block" @update:value="updateItem" @remove="() => removeItem(block)" :key="block.id" :hpml="hpml"/>
|
<template #item="{element}">
|
||||||
|
<component :is="'x-' + element.type" :value="element" @update:value="updateItem" @remove="() => removeItem(element)" :hpml="hpml"/>
|
||||||
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ import * as os from '@/os';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XDraggable: defineAsyncComponent(() => import('vue-draggable-next').then(x => x.VueDraggableNext)),
|
XDraggable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)),
|
||||||
XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter, XRadioButton, XCanvas, XNote
|
XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter, XRadioButton, XCanvas, XNote
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -39,9 +41,16 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['update:value'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
blocks() {
|
blocks: {
|
||||||
return this.value;
|
get() {
|
||||||
|
return this.value;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit('update:value', value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -57,6 +66,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
removeItem(el) {
|
removeItem(el) {
|
||||||
|
console.log(el);
|
||||||
const i = this.blocks.findIndex(x => x.id === el.id);
|
const i = this.blocks.findIndex(x => x.id === el.id);
|
||||||
const newValue = [
|
const newValue = [
|
||||||
...this.blocks.slice(0, i),
|
...this.blocks.slice(0, i),
|
||||||
|
@ -52,6 +52,7 @@ export default defineComponent({
|
|||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
emits: ['toggle', 'remove'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showBody: this.expanded,
|
showBody: this.expanded,
|
||||||
|
@ -53,18 +53,19 @@
|
|||||||
<MkContainer :body-togglable="true" class="_vMargin">
|
<MkContainer :body-togglable="true" class="_vMargin">
|
||||||
<template #header><Fa :icon="faMagic"/> {{ $t('_pages.variables') }}</template>
|
<template #header><Fa :icon="faMagic"/> {{ $t('_pages.variables') }}</template>
|
||||||
<div class="qmuvgica">
|
<div class="qmuvgica">
|
||||||
<XDraggable tag="div" class="variables" v-show="variables.length > 0" :list="variables" handle=".drag-handle" :group="{ name: 'variables' }" animation="150" swap-threshold="0.5">
|
<XDraggable tag="div" class="variables" v-show="variables.length > 0" v-model="variables" item-key="name" handle=".drag-handle" :group="{ name: 'variables' }" animation="150" swap-threshold="0.5">
|
||||||
<XVariable v-for="variable in variables"
|
<template #item="{element}">
|
||||||
:value="variable"
|
<XVariable
|
||||||
:removable="true"
|
:value="element"
|
||||||
@update:value="v => updateVariable(v)"
|
:removable="true"
|
||||||
@remove="() => removeVariable(variable)"
|
@update:value="v => updateVariable(v)"
|
||||||
:key="variable.name"
|
@remove="() => removeVariable(element)"
|
||||||
:hpml="hpml"
|
:hpml="hpml"
|
||||||
:name="variable.name"
|
:name="element.name"
|
||||||
:title="variable.name"
|
:title="element.name"
|
||||||
:draggable="true"
|
:draggable="true"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
|
|
||||||
<MkButton @click="addVariable()" class="add" v-if="!readonly"><Fa :icon="faPlus"/></MkButton>
|
<MkButton @click="addVariable()" class="add" v-if="!readonly"><Fa :icon="faPlus"/></MkButton>
|
||||||
@ -109,7 +110,7 @@ import { selectFile } from '@/scripts/select-file';
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XDraggable: defineAsyncComponent(() => import('vue-draggable-next').then(x => x.VueDraggableNext)),
|
XDraggable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)),
|
||||||
XVariable, XBlocks, MkTextarea, MkContainer, MkButton, MkSelect, MkSwitch, MkInput,
|
XVariable, XBlocks, MkTextarea, MkContainer, MkButton, MkSelect, MkSwitch, MkInput,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,16 +3,18 @@
|
|||||||
<div class="_formItem">
|
<div class="_formItem">
|
||||||
<div class="_formLabel">{{ $t('reactionSettingDescription') }}</div>
|
<div class="_formLabel">{{ $t('reactionSettingDescription') }}</div>
|
||||||
<div class="_formPanel">
|
<div class="_formPanel">
|
||||||
<XDraggable class="zoaiodol" :list="reactions" animation="150" delay="100" delay-on-touch-only="true">
|
<XDraggable class="zoaiodol" v-model="reactions" :item-key="item => item" animation="150" delay="100" delay-on-touch-only="true">
|
||||||
<button class="_button item" v-for="reaction in reactions" :key="reaction" @click="remove(reaction, $event)">
|
<template #item="{element}">
|
||||||
<MkEmoji :emoji="reaction" :normal="true"/>
|
<button class="_button item" @click="remove(element, $event)">
|
||||||
</button>
|
<MkEmoji :emoji="element" :normal="true"/>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button>a</button>
|
<button class="_button add" @click="chooseEmoji"><Fa :icon="faPlus"/></button>
|
||||||
</template>
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
</div>
|
</div>
|
||||||
<div class="_formCaption">{{ $t('reactionSettingDescription2') }} <button class="_textButton" @click="chooseEmoji">{{ $t('chooseEmoji') }}</button></div>
|
<div class="_formCaption">{{ $t('reactionSettingDescription2') }} <button class="_textButton" @click="preview">{{ $t('preview') }}</button></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormRadios v-model="reactionPickerWidth">
|
<FormRadios v-model="reactionPickerWidth">
|
||||||
@ -35,8 +37,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
|
import { faLaugh, faSave, faEye } from '@fortawesome/free-regular-svg-icons';
|
||||||
import { faUndo } from '@fortawesome/free-solid-svg-icons';
|
import { faUndo, faPlus } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { VueDraggableNext } from 'vue-draggable-next';
|
import XDraggable from 'vuedraggable';
|
||||||
import FormInput from '@/components/form/input.vue';
|
import FormInput from '@/components/form/input.vue';
|
||||||
import FormRadios from '@/components/form/radios.vue';
|
import FormRadios from '@/components/form/radios.vue';
|
||||||
import FormBase from '@/components/form/base.vue';
|
import FormBase from '@/components/form/base.vue';
|
||||||
@ -50,7 +52,7 @@ export default defineComponent({
|
|||||||
FormButton,
|
FormButton,
|
||||||
FormBase,
|
FormBase,
|
||||||
FormRadios,
|
FormRadios,
|
||||||
XDraggable: VueDraggableNext,
|
XDraggable,
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['info'],
|
emits: ['info'],
|
||||||
@ -66,7 +68,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
reactions: JSON.parse(JSON.stringify(this.$store.state.settings.reactions)),
|
reactions: JSON.parse(JSON.stringify(this.$store.state.settings.reactions)),
|
||||||
faLaugh, faSave, faEye, faUndo
|
faLaugh, faSave, faEye, faUndo, faPlus
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -152,5 +154,10 @@ export default defineComponent({
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> .add {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -298,6 +298,7 @@ export const store = createStore({
|
|||||||
},
|
},
|
||||||
|
|
||||||
//#region Deck
|
//#region Deck
|
||||||
|
// TODO: deck関連は動的にモジュール読み込みしたい
|
||||||
addDeckColumn(state, column) {
|
addDeckColumn(state, column) {
|
||||||
if (column.name == undefined) column.name = null;
|
if (column.name == undefined) column.name = null;
|
||||||
state.deck.columns.push(column);
|
state.deck.columns.push(column);
|
||||||
@ -415,6 +416,12 @@ export const store = createStore({
|
|||||||
column.widgets = column.widgets.filter(w => w.id != x.widget.id);
|
column.widgets = column.widgets.filter(w => w.id != x.widget.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setDeckWidgets(state, x) {
|
||||||
|
const column = state.deck.columns.find(c => c.id == x.id);
|
||||||
|
if (column == null) return;
|
||||||
|
column.widgets = x.widgets;
|
||||||
|
},
|
||||||
|
|
||||||
renameDeckColumn(state, x) {
|
renameDeckColumn(state, x) {
|
||||||
const column = state.deck.columns.find(c => c.id == x.id);
|
const column = state.deck.columns.find(c => c.id == x.id);
|
||||||
if (column == null) return;
|
if (column == null) return;
|
||||||
@ -422,9 +429,9 @@ export const store = createStore({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateDeckColumn(state, x) {
|
updateDeckColumn(state, x) {
|
||||||
let column = state.deck.columns.find(c => c.id == x.id);
|
const column = state.deck.columns.findIndex(c => c.id == x.id);
|
||||||
if (column == null) return;
|
if (column > -1) return;
|
||||||
column = x;
|
state.deck.columns[column] = x;
|
||||||
},
|
},
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<XSidebar ref="nav"/>
|
<XSidebar ref="nav"/>
|
||||||
|
|
||||||
<!-- TODO: deckMainColumnPlace を見て位置変える -->
|
<!-- TODO: deckMainColumnPlace を見て位置変える -->
|
||||||
<deck-column class="column" v-if="$store.state.device.deckAlwaysShowMainColumn || $route.name !== 'index'">
|
<DeckColumn class="column" v-if="$store.state.device.deckAlwaysShowMainColumn || $route.name !== 'index'">
|
||||||
<template #header>
|
<template #header>
|
||||||
<XHeader :info="pageInfo"/>
|
<XHeader :info="pageInfo"/>
|
||||||
</template>
|
</template>
|
||||||
@ -15,13 +15,13 @@
|
|||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
</deck-column>
|
</DeckColumn>
|
||||||
|
|
||||||
<template v-for="ids in layout">
|
<template v-for="ids in layout">
|
||||||
<div v-if="ids.length > 1" class="folder column">
|
<div v-if="ids.length > 1" class="folder column">
|
||||||
<deck-column-core v-for="id in ids" :ref="id" :key="id" :column="columns.find(c => c.id === id)" :is-stacked="true" @parent-focus="moveFocus(id, $event)"/>
|
<DeckColumnCore v-for="id in ids" :ref="id" :key="id" :column="columns.find(c => c.id === id)" :is-stacked="true" @parent-focus="moveFocus(id, $event)"/>
|
||||||
</div>
|
</div>
|
||||||
<deck-column-core v-else class="column" :ref="ids[0]" :key="ids[0]" :column="columns.find(c => c.id === ids[0])" @parent-focus="moveFocus(ids[0], $event)"/>
|
<DeckColumnCore v-else class="column" :ref="ids[0]" :key="ids[0]" :column="columns.find(c => c.id === ids[0])" @parent-focus="moveFocus(ids[0], $event)"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<button @click="addColumn" class="_button add"><Fa :icon="faPlus"/></button>
|
<button @click="addColumn" class="_button add"><Fa :icon="faPlus"/></button>
|
||||||
|
@ -13,14 +13,16 @@
|
|||||||
<MkButton inline @click="edit = false">{{ $t('close') }}</MkButton>
|
<MkButton inline @click="edit = false">{{ $t('close') }}</MkButton>
|
||||||
</header>
|
</header>
|
||||||
<XDraggable
|
<XDraggable
|
||||||
:list="column.widgets"
|
v-model="_widgets"
|
||||||
|
item-key="id"
|
||||||
animation="150"
|
animation="150"
|
||||||
@sort="onWidgetSort"
|
|
||||||
>
|
>
|
||||||
<div v-for="widget in column.widgets" class="customize-container" :key="widget.id" @click="widgetFunc(widget.id)">
|
<template #item="{element}">
|
||||||
<button class="remove _button" @click.prevent.stop="removeWidget(widget)"><Fa :icon="faTimes"/></button>
|
<div class="customize-container" @click="widgetFunc(element.id)">
|
||||||
<component :is="`mkw-${widget.name}`" :widget="widget" :setting-callback="setting => settings[widget.id] = setting" :column="column"/>
|
<button class="remove _button" @click.prevent.stop="removeWidget(element)"><Fa :icon="faTimes"/></button>
|
||||||
</div>
|
<component :is="`mkw-${element.name}`" :widget="element" :setting-callback="setting => settings[element.id] = setting" :column="column"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
</template>
|
</template>
|
||||||
<component v-else class="widget" v-for="widget in column.widgets" :is="`mkw-${widget.name}`" :key="widget.id" :widget="widget" :column="column"/>
|
<component v-else class="widget" v-for="widget in column.widgets" :is="`mkw-${widget.name}`" :key="widget.id" :widget="widget" :column="column"/>
|
||||||
@ -40,7 +42,7 @@ import { widgets } from '../../widgets';
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
XColumn,
|
XColumn,
|
||||||
XDraggable: defineAsyncComponent(() => import('vue-draggable-next').then(x => x.VueDraggableNext)),
|
XDraggable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)),
|
||||||
MkSelect,
|
MkSelect,
|
||||||
MkButton,
|
MkButton,
|
||||||
},
|
},
|
||||||
@ -67,6 +69,20 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
_widgets: {
|
||||||
|
get() {
|
||||||
|
return this.column.widgets;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('deviceUser/setDeckWidgets', {
|
||||||
|
id: this.column.id,
|
||||||
|
widgets: value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.menu = [{
|
this.menu = [{
|
||||||
icon: faCog,
|
icon: faCog,
|
||||||
@ -82,10 +98,6 @@ export default defineComponent({
|
|||||||
this.settings[id]();
|
this.settings[id]();
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetSort() {
|
|
||||||
this.saveWidgets();
|
|
||||||
},
|
|
||||||
|
|
||||||
addWidget() {
|
addWidget() {
|
||||||
if (this.widgetAdderSelected == null) return;
|
if (this.widgetAdderSelected == null) return;
|
||||||
|
|
||||||
@ -107,10 +119,6 @@ export default defineComponent({
|
|||||||
widget
|
widget
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
saveWidgets() {
|
|
||||||
this.$store.commit('deviceUser/updateDeckColumn', this.column);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,20 +3,22 @@
|
|||||||
<template v-if="editMode">
|
<template v-if="editMode">
|
||||||
<MkButton primary @click="addWidget" class="add"><Fa :icon="faPlus"/></MkButton>
|
<MkButton primary @click="addWidget" class="add"><Fa :icon="faPlus"/></MkButton>
|
||||||
<XDraggable
|
<XDraggable
|
||||||
:list="widgets"
|
v-model="widgets"
|
||||||
|
item-key="id"
|
||||||
handle=".handle"
|
handle=".handle"
|
||||||
animation="150"
|
animation="150"
|
||||||
class="sortable"
|
class="sortable"
|
||||||
@sort="onWidgetSort"
|
|
||||||
>
|
>
|
||||||
<div v-for="widget in widgets" class="customize-container _panel" :key="widget.id">
|
<template #item="{element}">
|
||||||
<header>
|
<div class="customize-container _panel">
|
||||||
<span class="handle"><Fa :icon="faBars"/></span>{{ $t('_widgets.' + widget.name) }}<button class="remove _button" @click="removeWidget(widget)"><Fa :icon="faTimes"/></button>
|
<header>
|
||||||
</header>
|
<span class="handle"><Fa :icon="faBars"/></span>{{ $t('_widgets.' + element.name) }}<button class="remove _button" @click="removeWidget(element)"><Fa :icon="faTimes"/></button>
|
||||||
<div @click="widgetFunc(widget.id)">
|
</header>
|
||||||
<component class="_close_ _forceContainerFull_" :is="`mkw-${widget.name}`" :widget="widget" :ref="widget.id" :setting-callback="setting => settings[widget.id] = setting"/>
|
<div @click="widgetFunc(element.id)">
|
||||||
|
<component class="_close_ _forceContainerFull_" :is="`mkw-${element.name}`" :widget="element" :ref="element.id" :setting-callback="setting => settings[element.id] = setting"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</XDraggable>
|
</XDraggable>
|
||||||
<button @click="editMode = false" class="_textButton" style="font-size: 0.9em;"><Fa :icon="faCheck"/> {{ $t('editWidgetsExit') }}</button>
|
<button @click="editMode = false" class="_textButton" style="font-size: 0.9em;"><Fa :icon="faCheck"/> {{ $t('editWidgetsExit') }}</button>
|
||||||
</template>
|
</template>
|
||||||
@ -38,7 +40,7 @@ import MkButton from '@/components/ui/button.vue';
|
|||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
MkButton,
|
MkButton,
|
||||||
XDraggable: defineAsyncComponent(() => import('vue-draggable-next').then(x => x.VueDraggableNext)),
|
XDraggable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)),
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['mounted'],
|
emits: ['mounted'],
|
||||||
@ -52,8 +54,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
widgets(): any {
|
widgets: {
|
||||||
return this.$store.state.deviceUser.widgets;
|
get() {
|
||||||
|
return this.$store.state.deviceUser.widgets;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.commit('deviceUser/setWidgets', value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -66,11 +73,6 @@ export default defineComponent({
|
|||||||
this.settings[id]();
|
this.settings[id]();
|
||||||
},
|
},
|
||||||
|
|
||||||
onWidgetSort() {
|
|
||||||
// TODO: vuexを直接書き換えているのでなんとかする
|
|
||||||
this.saveHome();
|
|
||||||
},
|
|
||||||
|
|
||||||
async addWidget() {
|
async addWidget() {
|
||||||
const { canceled, result: widget } = await os.dialog({
|
const { canceled, result: widget } = await os.dialog({
|
||||||
type: null,
|
type: null,
|
||||||
|
16
yarn.lock
16
yarn.lock
@ -8826,7 +8826,7 @@ sort-keys@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-plain-obj "^1.0.0"
|
is-plain-obj "^1.0.0"
|
||||||
|
|
||||||
sortablejs@^1.10.2:
|
sortablejs@1.10.2:
|
||||||
version "1.10.2"
|
version "1.10.2"
|
||||||
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.10.2.tgz#6e40364d913f98b85a14f6678f92b5c1221f5290"
|
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.10.2.tgz#6e40364d913f98b85a14f6678f92b5c1221f5290"
|
||||||
integrity sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==
|
integrity sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==
|
||||||
@ -10144,13 +10144,6 @@ vue-color@2.7.1:
|
|||||||
material-colors "^1.0.0"
|
material-colors "^1.0.0"
|
||||||
tinycolor2 "^1.1.2"
|
tinycolor2 "^1.1.2"
|
||||||
|
|
||||||
vue-draggable-next@1.0.8:
|
|
||||||
version "1.0.8"
|
|
||||||
resolved "https://registry.yarnpkg.com/vue-draggable-next/-/vue-draggable-next-1.0.8.tgz#89a8b347422d20f694f977a125b9af2f67e85b99"
|
|
||||||
integrity sha512-c15YO8HC2Lo2+rWXNoLDwiAFzf4pY5L4ESJsWp526qWeLAf6WjIXYSchmsO6AD0ozFIc+sp6B9zKafpFotxNIQ==
|
|
||||||
dependencies:
|
|
||||||
sortablejs "^1.10.2"
|
|
||||||
|
|
||||||
vue-eslint-parser@^7.1.1:
|
vue-eslint-parser@^7.1.1:
|
||||||
version "7.1.1"
|
version "7.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.1.1.tgz#c43c1c715ff50778b9a7e9a4e16921185f3425d3"
|
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.1.1.tgz#c43c1c715ff50778b9a7e9a4e16921185f3425d3"
|
||||||
@ -10211,6 +10204,13 @@ vue@3.0.3:
|
|||||||
"@vue/runtime-dom" "3.0.3"
|
"@vue/runtime-dom" "3.0.3"
|
||||||
"@vue/shared" "3.0.3"
|
"@vue/shared" "3.0.3"
|
||||||
|
|
||||||
|
vuedraggable@4.0.1:
|
||||||
|
version "4.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/vuedraggable/-/vuedraggable-4.0.1.tgz#3bcaab0808b7944030b7d9a29f9a63d59dfa12c5"
|
||||||
|
integrity sha512-7qN5jhB1SLfx5P+HCm3JUW+pvgA1bSLgYLSVOeLWBDH9z+zbaEH0OlyZBVMLOxFR+JUHJjwDD0oy7T4r9TEgDA==
|
||||||
|
dependencies:
|
||||||
|
sortablejs "1.10.2"
|
||||||
|
|
||||||
vuex-persistedstate@3.1.0:
|
vuex-persistedstate@3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-3.1.0.tgz#a710d01000bff8336bc3b03fa3ef42e376094b71"
|
resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-3.1.0.tgz#a710d01000bff8336bc3b03fa3ef42e376094b71"
|
||||||
|
Loading…
Reference in New Issue
Block a user