refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
This commit is contained in:
@@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeUnmount, onMounted, provide, watch } from 'vue';
|
||||
import { onBeforeUnmount, onMounted, provide, watch, shallowRef, ref, computed } from 'vue';
|
||||
import { updateColumn, swapLeftColumn, swapRightColumn, swapUpColumn, swapDownColumn, stackLeftColumn, popRightColumn, removeColumn, swapColumn, Column } from './deck-store';
|
||||
import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
@@ -67,16 +67,16 @@ const emit = defineEmits<{
|
||||
(ev: 'headerWheel', ctx: WheelEvent): void;
|
||||
}>();
|
||||
|
||||
let body = $shallowRef<HTMLDivElement | null>();
|
||||
const body = shallowRef<HTMLDivElement | null>();
|
||||
|
||||
let dragging = $ref(false);
|
||||
watch($$(dragging), v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd'));
|
||||
const dragging = ref(false);
|
||||
watch(dragging, v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd'));
|
||||
|
||||
let draghover = $ref(false);
|
||||
let dropready = $ref(false);
|
||||
const draghover = ref(false);
|
||||
const dropready = ref(false);
|
||||
|
||||
const isMainColumn = $computed(() => props.column.type === 'main');
|
||||
const active = $computed(() => props.column.active !== false);
|
||||
const isMainColumn = computed(() => props.column.type === 'main');
|
||||
const active = computed(() => props.column.active !== false);
|
||||
|
||||
onMounted(() => {
|
||||
os.deckGlobalEvents.on('column.dragStart', onOtherDragStart);
|
||||
@@ -89,11 +89,11 @@ onBeforeUnmount(() => {
|
||||
});
|
||||
|
||||
function onOtherDragStart() {
|
||||
dropready = true;
|
||||
dropready.value = true;
|
||||
}
|
||||
|
||||
function onOtherDragEnd() {
|
||||
dropready = false;
|
||||
dropready.value = false;
|
||||
}
|
||||
|
||||
function toggleActive() {
|
||||
@@ -208,8 +208,8 @@ function onContextmenu(ev: MouseEvent) {
|
||||
}
|
||||
|
||||
function goTop() {
|
||||
if (body) {
|
||||
body.scrollTo({
|
||||
if (body.value) {
|
||||
body.value.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
@@ -223,17 +223,17 @@ function onDragstart(ev) {
|
||||
// Chromeのバグで、Dragstartハンドラ内ですぐにDOMを変更する(=リアクティブなプロパティを変更する)とDragが終了してしまう
|
||||
// SEE: https://stackoverflow.com/questions/19639969/html5-dragend-event-firing-immediately
|
||||
window.setTimeout(() => {
|
||||
dragging = true;
|
||||
dragging.value = true;
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function onDragend(ev) {
|
||||
dragging = false;
|
||||
dragging.value = false;
|
||||
}
|
||||
|
||||
function onDragover(ev) {
|
||||
// 自分自身がドラッグされている場合
|
||||
if (dragging) {
|
||||
if (dragging.value) {
|
||||
// 自分自身にはドロップさせない
|
||||
ev.dataTransfer.dropEffect = 'none';
|
||||
} else {
|
||||
@@ -241,16 +241,16 @@ function onDragover(ev) {
|
||||
|
||||
ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none';
|
||||
|
||||
if (isDeckColumn) draghover = true;
|
||||
if (isDeckColumn) draghover.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function onDragleave() {
|
||||
draghover = false;
|
||||
draghover.value = false;
|
||||
}
|
||||
|
||||
function onDrop(ev) {
|
||||
draghover = false;
|
||||
draghover.value = false;
|
||||
os.deckGlobalEvents.emit('column.dragEnd');
|
||||
|
||||
const id = ev.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_);
|
||||
|
Reference in New Issue
Block a user